问题
Is there a VB.NET equivalent to java.util.TreeSet?
回答1:
The closest you'll find is the SortedSet(T) class.
回答2:
Strangely, the .NET FCL does not include tree-bases data structures/collections. You can implement your own though. See here for a C# example (easy enough to convert to VB.NET)
The C5 Library is a well-regarded project that:
... provides the following data structures, described by C# classes: array list, doubly linked list, hash-indexed array list, hash-indexed linked list, hash set, hash bag (multiset), sorted array, wrapped array, tree set, tree bag (multiset), stack, double-ended queue, circular queue, priority queue (interval heap), hash dictionary, and tree dictionary.
C5 is also C#-based but it does come as a DLL so you wouldn't even have to worry about the language. Just reference it in your solution and off you go.
回答3:
There's nothing built-in, but you could use the TreeSet<T> implementation from the C5 library. This sounds as though it's roughly equivalent, although I haven't used it myself.
来源:https://stackoverflow.com/questions/2516517/vb-net-equivalent-to-java-util-treeset