hashset

Requirements for entities in NHibernate to be used in a HashedSet.

I would like to use the Iesi.Collections HashedSet class for entity collections in NHibernate. The functionality I want is that duplicate entities cannot be added. I would like entities to be considered duplicate if they share the Id (i.e. primary key) field, or, if they have Id == 0 (i.e. unsaved), then certain key properties are compar...

C# HashSet union on IEnumerable within LINQ Func expression does not work (possible precompiler bug)

I am using using Microsoft .NET Framework 4.0. I have run into this using Aggregate on a Dictionary<T, List<T>> to extract the set of type T values used across all type List<T> lists in the dictionary. Here is the simplest case I could come up with that exhibits the same behaviour. First, as the documentation states, the following does...

What's the difference between theese two java variable declarations?

in java... public class someclass { private HashSet<Someobject> contents = new HashSet<Someobject>(); private Set<Someobject> contents2 = new HashSet<Someobject>(); } what's the difference? in the end it's both a hashset isn't it? the second one looks just wrong to me but i have seen it frequently used, accepted and working......

How do I hash a 2-d array efficiently (to be stored in a HashSet)?

I've written a class called PuzzleBoard that represents an nxn board. I will be keeping several PuzzleBoard objects in a HashSet, so I have to overwrite the 'int hashCode()' method. Below are the fields of my class: private int N; private int[][] puzzle; private int blankCellX; private int blankCellY; private int cost; What Ecli...

HashSet with two equals object?

I created an object HashSet, and the value is an object (Triple) which is my own class. But I get a strange thing, when there are two equal objects on my HashSet, is it possible? Here is my overriding method for the equals in the class Triple @Override public boolean equals(Object other){ if (other == null) return false; if (other =...