-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm intialising a HashSet like so in my program:
Set<String> namesFilter = new HashSet<String>();
Is this functionally any different if I initilise like so?
HashSet<String> namesFilter = new HashSet<String>();
I've read this about the collections interface, and I understand…
>>> More
-
as seen on Johnny Coder
- Search for 'Johnny Coder'
I hadn’t done much (read: anything) with the C# generic HashSet until I recently needed to produce a distinct collection. As it turns out, HashSet<T> was the perfect tool.
As the following snippet demonstrates, this collection type offers a lot:
// Using HashSet<T>:
// http://www…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Why does Java not provide functions to get at the key/value pairs in a HashSet like in Hashtable? It seems like a real pain to have to iterate over it every time you need to get at something. Or am I just a newb missing something?
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I've got a HashSet with a bunch of (you guessed it) integers in it. I want to turn it into an array, but calling
hashset.toArray();
returns an array of Object type. This is fine, but is there a better way to cast it to an array of int, other than iterating through every element manually? A method…
>>> More
-
as seen on Geeks with Blogs
- Search for 'Geeks with Blogs'
Once again we consider some of the lesser known classes and keywords of C#. Today we will be looking at two set implementations in the System.Collections.Generic namespace: HashSet<T> and SortedSet<T>. Even though most people think of sets as mathematical constructs, they are actually…
>>> More