안녕하세요, 다음 함수가 있습니다 :
입력 ArrayList 결과가 올바르게 정렬되었습니다.
리턴 값 returnList는 completly unordered입니다.
문제는 HashTable이 올바르게 주문되지 않았다고 생각합니다.
Hashtable을 주문할 수있는 방법이 있습니까, 아니면 어쨌든 returnList를 정렬해야합니까?
필드를 정렬하거나 정렬하고 싶습니다. HashList
에서
HashList를 주문하는 방법?
Private Function FilterDepartementenSurveys(ByVal results As ArrayList) As ArrayList
Dim hashTable As New Hashtable(results.Count)
For Each resultaat As DTO.Results.Reporting.FilledInSurvey In results
If Not hashTable.ContainsKey(resultaat.DepartmentCode) Then
hashTable.Add(resultaat.DepartmentCode, New ArrayList)
End If
Dim arraylist As ArrayList = CType(hashTable(resultaat.DepartmentCode), Collections.ArrayList)
arraylist.Add(resultaat)
Next
Dim returnList As New ArrayList
For Each list As ArrayList In hashTable.Values
returnList.Add(list)
Next
Return returnList
End Function
아래의 구현을 사용하는 호출하기위한
는 HashList 같은 것은 없습니다. Hashtable 또는 Dictionary는 근본적으로 순서가 없습니다. 그것이 그들이 빠른 이유입니다. –
returnList에는 배열 배열이 있습니다. 이 경우에 "주문한"것은 무엇을 의미합니까? (배열에 대한 일반적인 비교가 없습니다) – Ando