Example usage for org.apache.commons.collections.iterators UnmodifiableIterator decorate

List of usage examples for org.apache.commons.collections.iterators UnmodifiableIterator decorate

Introduction

In this page you can find the example usage for org.apache.commons.collections.iterators UnmodifiableIterator decorate.

Prototype

public static Iterator decorate(Iterator iterator) 

Source Link

Document

Decorates the specified iterator such that it cannot be modified.

Usage

From source file:org.apache.hadoop.hbase.CompoundConfiguration.java

@Override
public Iterator<Map.Entry<String, String>> iterator() {
    Map<String, String> ret = new HashMap<String, String>();

    // add in reverse order so that oldest get overridden.
    if (!configs.isEmpty()) {
        for (int i = configs.size() - 1; i >= 0; i--) {
            ImmutableConfigMap map = configs.get(i);
            Iterator<Map.Entry<String, String>> iter = map.iterator();
            while (iter.hasNext()) {
                Map.Entry<String, String> entry = iter.next();
                ret.put(entry.getKey(), entry.getValue());
            }/*  www. j  av  a  2s .  co  m*/
        }
    }

    // add mutations to this CompoundConfiguration last.
    if (mutableConf != null) {
        Iterator<Map.Entry<String, String>> miter = mutableConf.iterator();
        while (miter.hasNext()) {
            Map.Entry<String, String> entry = miter.next();
            ret.put(entry.getKey(), entry.getValue());
        }
    }

    return UnmodifiableIterator.decorate(ret.entrySet().iterator());
}

From source file:org.apache.hadoop.hbase.regionserver.CompoundConfiguration.java

@Override
public Iterator<Map.Entry<String, String>> iterator() {
    Map<String, String> ret = new HashMap<String, String>();

    // add in reverse order so that oldest get overridden.
    if (!configs.isEmpty()) {
        for (int i = configs.size() - 1; i >= 0; i--) {
            ImmutableConfigMap map = configs.get(i);
            Iterator<Map.Entry<String, String>> iter = map.iterator();
            while (iter.hasNext()) {
                Map.Entry<String, String> entry = iter.next();
                ret.put(entry.getKey(), entry.getValue());
            }//from w ww . j  a v a 2  s  .  c o m
        }
    }
    // add mutations to this CompoundConfiguration last.
    if (mutableConf != null) {
        Iterator<Map.Entry<String, String>> miter = mutableConf.iterator();
        while (miter.hasNext()) {
            Map.Entry<String, String> entry = miter.next();
            ret.put(entry.getKey(), entry.getValue());
        }
    }

    return UnmodifiableIterator.decorate(ret.entrySet().iterator());
}

From source file:org.lockss.util.PdfUtil.java

public static Iterator getPdf16Operators() {
    return UnmodifiableIterator.decorate(new ObjectArrayIterator(PDF_1_6_OPERATORS));
}