1 9 package org.ozoneDB.DxLib; 10 11 17 public abstract class DxAbstractSet extends DxAbstractCollection implements DxSet { 18 19 final static long serialVersionUID = 1L; 20 21 22 23 public boolean equals( Object obj ) { 24 if (obj instanceof DxSet && obj != null) { 25 DxSet rhs = (DxSet)obj; 26 27 if (this == obj) { 28 return true; 29 } 30 31 if (count() != rhs.count()) { 32 return false; 33 } 34 35 return containsAll( rhs ); 36 } else { 37 return false; 38 } 39 } 40 41 42 44 public synchronized boolean retainAll( DxCollection coll ) { 45 boolean answer = false; 46 DxIterator it = iterator(); 47 Object obj; 48 while ((obj = it.next()) != null) { 49 if (!coll.contains( obj )) { 50 it.removeObject(); 51 answer = true; 52 } 53 } 54 return answer; 55 } 56 57 } 58 | Popular Tags |