/** * Get the maximum number of elements that the Collection can contain. * <p> * This method uses the {@link BoundedCollection} interface to determine the * maximum size. If the collection does not implement this interface then * -1 is returned. * <p> * The collection does not have to implement this interface directly. * If the collection has been decorated using the decorators subpackage * then these will be removed to access the BoundedCollection. * * @param coll the collection to check * @return the maximum size of the BoundedCollection, -1 if no maximum size * @throws NullPointerException if the collection is null */ public static int maxSize(Collection coll) { if (coll == null) { throw new NullPointerException("The collection must not be null"); } if (coll instanceof BoundedCollection) { return ((BoundedCollection) coll).maxSize(); } try { BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll); return bcoll.maxSize(); } catch (IllegalArgumentException ex) { return -1; } }
/** * Factory method to create an unmodifiable bounded collection. * * @param coll the <code>BoundedCollection</code> to decorate, must not be null * @return a new unmodifiable bounded collection * @throws IllegalArgumentException if bag is null */ public static BoundedCollection decorate(BoundedCollection coll) { return new UnmodifiableBoundedCollection(coll); }
public Iterator iterator() { return UnmodifiableIterator.decorate(getCollection().iterator()); }
/** * Returns true if no more elements can be added to the Collection. * <p> * This method uses the {@link BoundedCollection} interface to determine the * full status. If the collection does not implement this interface then * false is returned. * <p> * The collection does not have to implement this interface directly. * If the collection has been decorated using the decorators subpackage * then these will be removed to access the BoundedCollection. * * @param coll the collection to check * @return true if the BoundedCollection is full * @throws NullPointerException if the collection is null */ public static boolean isFull(Collection coll) { if (coll == null) { throw new NullPointerException("The collection must not be null"); } if (coll instanceof BoundedCollection) { return ((BoundedCollection) coll).isFull(); } try { BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll); return bcoll.isFull(); } catch (IllegalArgumentException ex) { return false; } }
/** * Factory method to create an unmodifiable bounded collection. * * @param coll the <code>BoundedCollection</code> to decorate, must not be null * @return a new unmodifiable bounded collection * @throws IllegalArgumentException if bag is null */ public static BoundedCollection decorate(BoundedCollection coll) { return new UnmodifiableBoundedCollection(coll); }
public Iterator iterator() { return UnmodifiableIterator.decorate(getCollection().iterator()); }
/** * Returns true if no more elements can be added to the Collection. * <p> * This method uses the {@link BoundedCollection} interface to determine the * full status. If the collection does not implement this interface then * false is returned. * <p> * The collection does not have to implement this interface directly. * If the collection has been decorated using the decorators subpackage * then these will be removed to access the BoundedCollection. * * @param coll the collection to check * @return true if the BoundedCollection is full * @throws NullPointerException if the collection is null */ public static boolean isFull(Collection coll) { if (coll == null) { throw new NullPointerException("The collection must not be null"); } if (coll instanceof BoundedCollection) { return ((BoundedCollection) coll).isFull(); } try { BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll); return bcoll.isFull(); } catch (IllegalArgumentException ex) { return false; } }
throw new IllegalArgumentException("The collection is not a bounded collection"); return new UnmodifiableBoundedCollection((BoundedCollection) coll);
public Iterator iterator() { return UnmodifiableIterator.decorate(getCollection().iterator()); }
/** * Get the maximum number of elements that the Collection can contain. * <p> * This method uses the {@link BoundedCollection} interface to determine the * maximum size. If the collection does not implement this interface then * -1 is returned. * <p> * The collection does not have to implement this interface directly. * If the collection has been decorated using the decorators subpackage * then these will be removed to access the BoundedCollection. * * @param coll the collection to check * @return the maximum size of the BoundedCollection, -1 if no maximum size * @throws NullPointerException if the collection is null */ public static int maxSize(Collection coll) { if (coll == null) { throw new NullPointerException("The collection must not be null"); } if (coll instanceof BoundedCollection) { return ((BoundedCollection) coll).maxSize(); } try { BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll); return bcoll.maxSize(); } catch (IllegalArgumentException ex) { return -1; } }
throw new IllegalArgumentException("The collection is not a bounded collection"); return new UnmodifiableBoundedCollection((BoundedCollection) coll);
public Iterator iterator() { return UnmodifiableIterator.decorate(getCollection().iterator()); }
/** * Returns true if no more elements can be added to the Collection. * <p> * This method uses the {@link BoundedCollection} interface to determine the * full status. If the collection does not implement this interface then * false is returned. * <p> * The collection does not have to implement this interface directly. * If the collection has been decorated using the decorators subpackage * then these will be removed to access the BoundedCollection. * * @param coll the collection to check * @return true if the BoundedCollection is full * @throws NullPointerException if the collection is null */ public static boolean isFull(Collection coll) { if (coll == null) { throw new NullPointerException("The collection must not be null"); } if (coll instanceof BoundedCollection) { return ((BoundedCollection) coll).isFull(); } try { BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll); return bcoll.isFull(); } catch (IllegalArgumentException ex) { return false; } }
/** * Factory method to create an unmodifiable bounded collection. * * @param coll the <code>BoundedCollection</code> to decorate, must not be null * @return a new unmodifiable bounded collection * @throws IllegalArgumentException if bag is null */ public static BoundedCollection decorate(BoundedCollection coll) { return new UnmodifiableBoundedCollection(coll); }
public Iterator iterator() { return UnmodifiableIterator.decorate(getCollection().iterator()); }
/** * Get the maximum number of elements that the Collection can contain. * <p> * This method uses the {@link BoundedCollection} interface to determine the * maximum size. If the collection does not implement this interface then * -1 is returned. * <p> * The collection does not have to implement this interface directly. * If the collection has been decorated using the decorators subpackage * then these will be removed to access the BoundedCollection. * * @param coll the collection to check * @return the maximum size of the BoundedCollection, -1 if no maximum size * @throws NullPointerException if the collection is null */ public static int maxSize(Collection coll) { if (coll == null) { throw new NullPointerException("The collection must not be null"); } if (coll instanceof BoundedCollection) { return ((BoundedCollection) coll).maxSize(); } try { BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll); return bcoll.maxSize(); } catch (IllegalArgumentException ex) { return -1; } }
/** * Factory method to create an unmodifiable bounded collection. * * @param coll the <code>BoundedCollection</code> to decorate, must not be null * @return a new unmodifiable bounded collection * @throws IllegalArgumentException if bag is null */ public static BoundedCollection decorate(BoundedCollection coll) { return new UnmodifiableBoundedCollection(coll); }
public Iterator iterator() { return UnmodifiableIterator.decorate(getCollection().iterator()); }
/** * Get the maximum number of elements that the Collection can contain. * <p> * This method uses the {@link BoundedCollection} interface to determine the * maximum size. If the collection does not implement this interface then * -1 is returned. * <p> * The collection does not have to implement this interface directly. * If the collection has been decorated using the decorators subpackage * then these will be removed to access the BoundedCollection. * * @param coll the collection to check * @return the maximum size of the BoundedCollection, -1 if no maximum size * @throws NullPointerException if the collection is null */ public static int maxSize(Collection coll) { if (coll == null) { throw new NullPointerException("The collection must not be null"); } if (coll instanceof BoundedCollection) { return ((BoundedCollection) coll).maxSize(); } try { BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll); return bcoll.maxSize(); } catch (IllegalArgumentException ex) { return -1; } }
/** * Factory method to create an unmodifiable bounded collection. * * @param coll the <code>BoundedCollection</code> to decorate, must not be null * @return a new unmodifiable bounded collection * @throws IllegalArgumentException if bag is null */ public static BoundedCollection decorate(BoundedCollection coll) { return new UnmodifiableBoundedCollection(coll); }