3

Is there a VB.NET equivalent to java.util.TreeSet?

Roger
  • 31
  • 1
  • 2
  • Does this answer your question? [Equivalent of TreeSet in Java to C#.net](https://stackoverflow.com/questions/6827913/equivalent-of-treeset-in-java-to-c-net) – user7610 Jan 31 '21 at 10:46

3 Answers3

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.

Paul Sasik
  • 79,492
  • 20
  • 149
  • 189
2

The closest you'll find is the SortedSet(T) class.

Juliet
  • 80,494
  • 45
  • 196
  • 228
1

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.

LukeH
  • 263,068
  • 57
  • 365
  • 409