public boolean ensureValid(Object value){
  int count=-1;
  try {
    Collection<?> collection=(Collection<?>)value;
    count=collection.size();
  }
 catch (  Exception e) {
    try {
      count=Array.getLength(value);
    }
 catch (    IllegalArgumentException e2) {
    }
  }
  return ensureValid(count);
}

public boolean ensureValid ( Object value ) { int count = - 1 ; try { Collection < ? > collection = ( Collection < ? > ) value ; count = collection . size ( ) ; } catch ( Exception e ) { try { count = Array . getLength ( value ) ; } catch ( IllegalArgumentException e2 ) { } } return ensureValid ( count ) ; }
ensures the bounds are valid values for the object passed in . < p > returns false if the object is not indexable or if the numeric range is out of bounds .
