org.apache.commons.collections.Unmodifiable Java Examples

The following examples show how to use org.apache.commons.collections.Unmodifiable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnmodifiableEntrySet.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method to create an unmodifiable set of Map Entry objects.
 * 
 * @param set  the set to decorate, must not be null
 * @throws IllegalArgumentException if set is null
 */
public static Set decorate(Set set) {
    if (set instanceof Unmodifiable) {
        return set;
    }
    return new UnmodifiableEntrySet(set);
}
 
Example #2
Source File: UnmodifiableSortedMap.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method to create an unmodifiable sorted map.
 * 
 * @param map  the map to decorate, must not be null
 * @throws IllegalArgumentException if map is null
 */
public static SortedMap decorate(SortedMap map) {
    if (map instanceof Unmodifiable) {
        return map;
    }
    return new UnmodifiableSortedMap(map);
}
 
Example #3
Source File: UnmodifiableOrderedMap.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method to create an unmodifiable sorted map.
 * 
 * @param map  the map to decorate, must not be null
 * @throws IllegalArgumentException if map is null
 */
public static OrderedMap decorate(OrderedMap map) {
    if (map instanceof Unmodifiable) {
        return map;
    }
    return new UnmodifiableOrderedMap(map);
}
 
Example #4
Source File: UnmodifiableSortedSet.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method to create an unmodifiable set.
 * 
 * @param set  the set to decorate, must not be null
 * @throws IllegalArgumentException if set is null
 */
public static SortedSet decorate(SortedSet set) {
    if (set instanceof Unmodifiable) {
        return set;
    }
    return new UnmodifiableSortedSet(set);
}
 
Example #5
Source File: UnmodifiableSet.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method to create an unmodifiable set.
 * 
 * @param set  the set to decorate, must not be null
 * @throws IllegalArgumentException if set is null
 */
public static Set decorate(Set set) {
    if (set instanceof Unmodifiable) {
        return set;
    }
    return new UnmodifiableSet(set);
}
 
Example #6
Source File: UnmodifiableList.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method to create an unmodifiable list.
 * 
 * @param list  the list to decorate, must not be null
 * @throws IllegalArgumentException if list is null
 */
public static List decorate(List list) {
    if (list instanceof Unmodifiable) {
        return list;
    }
    return new UnmodifiableList(list);
}
 
Example #7
Source File: UnmodifiableMap.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method to create an unmodifiable map.
 * 
 * @param map  the map to decorate, must not be null
 * @throws IllegalArgumentException if map is null
 */
public static Map decorate(Map map) {
    if (map instanceof Unmodifiable) {
        return map;
    }
    return new UnmodifiableMap(map);
}
 
Example #8
Source File: UnmodifiableMapIterator.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * 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 MapIterator decorate(MapIterator iterator) {
    if (iterator == null) {
        throw new IllegalArgumentException("MapIterator must not be null");
    }
    if (iterator instanceof Unmodifiable) {
        return iterator;
    }
    return new UnmodifiableMapIterator(iterator);
}
 
Example #9
Source File: UnmodifiableOrderedMapIterator.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * 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 IllegalArgumentException("OrderedMapIterator must not be null");
    }
    if (iterator instanceof Unmodifiable) {
        return iterator;
    }
    return new UnmodifiableOrderedMapIterator(iterator);
}
 
Example #10
Source File: UnmodifiableListIterator.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * 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 ListIterator decorate(ListIterator iterator) {
    if (iterator == null) {
        throw new IllegalArgumentException("ListIterator must not be null");
    }
    if (iterator instanceof Unmodifiable) {
        return iterator;
    }
    return new UnmodifiableListIterator(iterator);
}
 
Example #11
Source File: UnmodifiableIterator.java    From Penetration_Testing_POC with Apache License 2.0 5 votes vote down vote up
/**
 * Decorates the specified iterator such that it cannot be modified.
 * <p>
 * If the iterator is already unmodifiable it is returned directly.
 *
 * @param iterator  the iterator to decorate
 * @throws IllegalArgumentException if the iterator is null
 */
public static Iterator decorate(Iterator iterator) {
    if (iterator == null) {
        throw new IllegalArgumentException("Iterator must not be null");
    }
    if (iterator instanceof Unmodifiable) {
        return iterator;
    }
    return new UnmodifiableIterator(iterator);
}
 
Example #12
Source File: UnmodifiableSortedBidiMap.java    From Penetration_Testing_POC with Apache License 2.0 3 votes vote down vote up
/**
 * Factory method to create an unmodifiable map.
 * <p>
 * If the map passed in is already unmodifiable, it is returned.
 * 
 * @param map  the map to decorate, must not be null
 * @return an unmodifiable SortedBidiMap
 * @throws IllegalArgumentException if map is null
 */
public static SortedBidiMap decorate(SortedBidiMap map) {
    if (map instanceof Unmodifiable) {
        return map;
    }
    return new UnmodifiableSortedBidiMap(map);
}
 
Example #13
Source File: UnmodifiableBidiMap.java    From Penetration_Testing_POC with Apache License 2.0 3 votes vote down vote up
/**
 * Factory method to create an unmodifiable map.
 * <p>
 * If the map passed in is already unmodifiable, it is returned.
 * 
 * @param map  the map to decorate, must not be null
 * @return an unmodifiable BidiMap
 * @throws IllegalArgumentException if map is null
 */
public static BidiMap decorate(BidiMap map) {
    if (map instanceof Unmodifiable) {
        return map;
    }
    return new UnmodifiableBidiMap(map);
}
 
Example #14
Source File: UnmodifiableOrderedBidiMap.java    From Penetration_Testing_POC with Apache License 2.0 3 votes vote down vote up
/**
 * Factory method to create an unmodifiable map.
 * <p>
 * If the map passed in is already unmodifiable, it is returned.
 * 
 * @param map  the map to decorate, must not be null
 * @return an unmodifiable OrderedBidiMap
 * @throws IllegalArgumentException if map is null
 */
public static OrderedBidiMap decorate(OrderedBidiMap map) {
    if (map instanceof Unmodifiable) {
        return map;
    }
    return new UnmodifiableOrderedBidiMap(map);
}
 
Example #15
Source File: UnmodifiableCollection.java    From Penetration_Testing_POC with Apache License 2.0 3 votes vote down vote up
/**
 * Factory method to create an unmodifiable collection.
 * <p>
 * If the collection passed in is already unmodifiable, it is returned.
 * 
 * @param coll  the collection to decorate, must not be null
 * @return an unmodifiable collection
 * @throws IllegalArgumentException if collection is null
 */
public static Collection decorate(Collection coll) {
    if (coll instanceof Unmodifiable) {
        return coll;
    }
    return new UnmodifiableCollection(coll);
}
 
Example #16
Source File: UnmodifiableBuffer.java    From Penetration_Testing_POC with Apache License 2.0 3 votes vote down vote up
/**
 * Factory method to create an unmodifiable buffer.
 * <p>
 * If the buffer passed in is already unmodifiable, it is returned.
 * 
 * @param buffer  the buffer to decorate, must not be null
 * @return an unmodifiable Buffer
 * @throws IllegalArgumentException if buffer is null
 */
public static Buffer decorate(Buffer buffer) {
    if (buffer instanceof Unmodifiable) {
        return buffer;
    }
    return new UnmodifiableBuffer(buffer);
}
 
Example #17
Source File: UnmodifiableBag.java    From Penetration_Testing_POC with Apache License 2.0 3 votes vote down vote up
/**
 * Factory method to create an unmodifiable bag.
 * <p>
 * If the bag passed in is already unmodifiable, it is returned.
 * 
 * @param bag  the bag to decorate, must not be null
 * @return an unmodifiable Bag
 * @throws IllegalArgumentException if bag is null
 */
public static Bag decorate(Bag bag) {
    if (bag instanceof Unmodifiable) {
        return bag;
    }
    return new UnmodifiableBag(bag);
}
 
Example #18
Source File: UnmodifiableSortedBag.java    From Penetration_Testing_POC with Apache License 2.0 3 votes vote down vote up
/**
 * Factory method to create an unmodifiable bag.
 * <p>
 * If the bag passed in is already unmodifiable, it is returned.
 * 
 * @param bag  the bag to decorate, must not be null
 * @return an unmodifiable SortedBag
 * @throws IllegalArgumentException if bag is null
 */
public static SortedBag decorate(SortedBag bag) {
    if (bag instanceof Unmodifiable) {
        return bag;
    }
    return new UnmodifiableSortedBag(bag);
}