1 9 package org.ozoneDB.DxLib; 10 11 12 16 public abstract class DxAbstractBag extends DxAbstractCollection implements DxBag { 17 18 final static long serialVersionUID = 1L; 19 20 21 public DxAbstractBag() { 22 } 23 24 25 30 public boolean equals( Object obj ) { 31 if (obj instanceof DxBag && obj != null) { 32 DxBag rhs = (DxBag)obj; 33 34 if (this == obj) { 35 return true; 36 } 37 if (count() != rhs.count()) { 38 return false; 39 } 40 41 DxIterator it = iterator(); 42 DxIterator it2 = rhs.iterator(); 43 Object cursor; 44 Object cursor2; 45 while ((cursor = it.next()) != null && (cursor2 = it2.next()) != null) { 46 if (!cursor.equals( cursor2 )) { 47 return false; 48 } 49 } 50 return true; 51 } else { 52 return false; 53 } 54 } 55 56 57 public synchronized boolean add( Object obj ) { 58 return addBack( obj ); 59 } 60 61 62 public synchronized boolean addBack( Object obj ) { 63 throw new RuntimeException ( "" ); 64 } 65 66 } 67 | Popular Tags |