Bug 135837 [Viewers] Problems with TreeSelection#equals(..) and StructuredSelection#equals(..)
N20060410-0010 TreeSelection#equals(..) is not symmetric with StructuredSelection#equals(..): - TreeSelection#equals(..) is always false if the argument is not instanceof TreeSelection - StructuredSelection.equals(..) can be true if the argument is a TreeSelection 3 Problems: (1) equals(..) should be symmetric, as defined in Object#equals(..) (2) hashCode() of both classes must return the same if objects are equal (currently, StructuredSelection#hashCode() is not even implemented!) (3) equality is currently only defined for the implementations. Should be defined on interfaces, since clients generally only know about the interface, not the implementation.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeSelection.java
List selection;
		TreePath[] paths;
		CustomHashtable element2TreePaths;
		
		private InitializeData(TreePath[] paths, IElementComparer comparer) {
			this.paths= new TreePath[paths.length];
			System.arraycopy(paths, 0, this.paths, 0, paths.length);
			element2TreePaths = new CustomHashtable(comparer);
			int size = paths.length;
			selection = new ArrayList(size);
			for (int i = 0; i < size; i++) {
				Object lastSegment= paths[i].getLastSegment();
				Object mapped= element2TreePaths.get(lastSegment);
				if (mapped == null) {
					selection.add(lastSegment);
					element2TreePaths.put(lastSegment, paths[i]);
				} else if (mapped instanceof List) {
					((List)mapped).add(paths[i]);
				} else {
					List newMapped= new ArrayList(2);
					newMapped.add(mapped);
					newMapped.add(paths[i]);
					element2TreePaths.put(lastSegment, newMapped);