//----------------------------------------------------------------------- /** * Constructor that decorates the specified iterator. * * @param iterator the iterator to decorate, must not be null * @throws IllegalArgumentException if the collection is null */ public AbstractOrderedMapIteratorDecorator(OrderedMapIterator iterator) : base() { if (iterator == null) { throw new java.lang.IllegalArgumentException("OrderedMapIterator must not be null"); } this.iterator = iterator; }
//----------------------------------------------------------------------- /** * Decorates the specified iterator such that it cannot be modified. * * @param iterator the iterator to decorate * @throws IllegalArgumentException if the iterator is null */ public static OrderedMapIterator decorate(OrderedMapIterator iterator) { if (iterator == null) { throw new java.lang.IllegalArgumentException("OrderedMapIterator must not be null"); } if (iterator is Unmodifiable) { return iterator; } return new UnmodifiableOrderedMapIterator(iterator); }
//----------------------------------------------------------------------- /** * Decorates the specified iterator such that it cannot be modified. * * @param iterator the iterator to decorate * @throws IllegalArgumentException if the iterator is null */ public static OrderedMapIterator decorate(OrderedMapIterator iterator) { if (iterator == null) { throw new java.lang.IllegalArgumentException("OrderedMapIterator must not be null"); } if (iterator is Unmodifiable) { return(iterator); } return(new UnmodifiableOrderedMapIterator(iterator)); }
//----------------------------------------------------------------------- /** * Constructor. * * @param iterator the iterator to decorate */ private UnmodifiableOrderedMapIterator(OrderedMapIterator iterator) : base() { this.iterator = iterator; }
//----------------------------------------------------------------------- public override OrderedMapIterator orderedMapIterator() { OrderedMapIterator it = getOrderedBidiMap().orderedMapIterator(); return(UnmodifiableOrderedMapIterator.decorate(it)); }