Example #1
0
 /**
  * Checks equality between a and b by ignoring list order.
  *
  * <p>This is because a frequent use case of "listA.is(listB)" is for "Select All" functionality,
  * and if a user selects items in a different order, we still want to consider listA equal to
  * listB.
  */
 @Override
 protected boolean isEqual(List<E> a, List<E> b) {
   if (ObjectUtils.eq(a, b)) {
     return true;
   } else if (a != null && b != null && a.size() == b.size()) {
     List<E> b2 = new ArrayList<E>(b);
     for (E e : a) {
       if (!b2.remove(e)) {
         return false;
       }
     }
     return true;
   } else {
     return false;
   }
 }
Example #2
0
 @Override
 public String toString() {
   List<E> e = getDirect();
   if (e == null) {
     return getValueObject().getName() + " null";
   }
   // Janky, but keep ListProperty.toString from being huge and accidentally ruining perf
   String s = getValueObject().getName() + " [";
   for (int i = 0; i < e.size() && i < 20; i++) {
     s += ObjectUtils.toStr(e.get(i), "null");
     if (i != e.size() - 1) {
       s += ", ";
     }
   }
   if (e.size() > 20) {
     s += "...";
   }
   s += "]";
   return s;
 }