public class TypedBag extends java.lang.Object
Bagto validate that elements added are of a specific type.
The validation of additions is performed via an instanceof test against
Class. If an object cannot be added to the
collection, an IllegalArgumentException is thrown.
|Modifier and Type||Method and Description|
Factory method to create a typed bag.
If there are any elements already in the bag being decorated, they are validated.
bag- the bag to decorate, must not be null
type- the type to allow into the bag, must not be null
java.lang.IllegalArgumentException- if bag or type is null
java.lang.IllegalArgumentException- if the bag contains invalid elements
Copyright © 2010 - 2020 Adobe. All Rights Reserved