Example #1
0
 /**
  * Returns {@code true} if {@code iterable} contains any object for which {@code equals(element)}
  * is true.
  */
 public static boolean contains(Iterable<?> iterable, @Nullable Object element) {
   if (iterable instanceof Collection) {
     Collection<?> collection = (Collection<?>) iterable;
     return Collections2.safeContains(collection, element);
   }
   return Iterators.contains(iterable.iterator(), element);
 }
Example #2
0
 @Override
 public boolean contains(Object o) {
   if (o instanceof Cell) {
     Cell<?, ?, ?> cell = (Cell<?, ?, ?>) o;
     Map<C, V> row = Maps.safeGet(rowMap(), cell.getRowKey());
     return row != null
         && Collections2.safeContains(
             row.entrySet(), Maps.immutableEntry(cell.getColumnKey(), cell.getValue()));
   }
   return false;
 }