public int maxSize() { return ((BoundedCollection) collection).maxSize(); }
public int maxSize() { return ((BoundedCollection) collection).maxSize(); }
/** * 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; } }
/** * 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; } }
/** * Tests max size */ public void testMaxSize() { resetFull(); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); ((BoundedFifoBuffer) collection).remove(); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); ((BoundedFifoBuffer) collection).add("jj"); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); }
/** * Tests max size */ public void testMaxSize() { resetFull(); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); ((BoundedFifoBuffer) collection).remove(); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); ((BoundedFifoBuffer) collection).add("jj"); assertEquals(getFullElements().length, ((BoundedCollection) collection).maxSize()); }
public void testMaxSize() { final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500); BoundedCollection bc = (BoundedCollection) bounded; assertEquals(2, bc.maxSize()); assertEquals(false, bc.isFull()); bounded.add("A"); assertEquals(false, bc.isFull()); bounded.add("B"); assertEquals(true, bc.isFull()); bounded.remove(); assertEquals(false, bc.isFull()); try { BoundedBuffer.decorate(new UnboundedFifoBuffer(), 0); fail(); } catch (IllegalArgumentException ex) {} try { BoundedBuffer.decorate(new UnboundedFifoBuffer(), -1); fail(); } catch (IllegalArgumentException ex) {} }
public int maxSize() { return ((BoundedCollection) collection).maxSize(); }
public int maxSize() { return ((BoundedCollection) collection).maxSize(); }
public int maxSize() { return ((BoundedCollection) collection).maxSize(); }
public int maxSize() { return ((BoundedCollection) collection).maxSize(); }
public int maxSize() { return ((BoundedCollection) collection).maxSize(); }
/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * 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; } }