Example usage for java.util AbstractMap.SimpleImmutableEntry AbstractMap.SimpleImmutableEntry

List of usage examples for java.util AbstractMap.SimpleImmutableEntry AbstractMap.SimpleImmutableEntry

Introduction

In this page you can find the example usage for java.util AbstractMap.SimpleImmutableEntry AbstractMap.SimpleImmutableEntry.

Prototype

public SimpleImmutableEntry(K key, V value) 

Source Link

Document

Creates an entry representing a mapping from the specified key to the specified value.

Usage

From source file:sf.net.experimaestro.utils.JSUtils.java

private static Iterable<? extends Map.Entry<Object, Object>> iterable(final NativeObject object) {
    final Object[] ids = object.getIds();
    return new Iterable<Map.Entry<Object, Object>>() {
        @Override//w  ww. jav  a  2  s .  com
        public Iterator<Map.Entry<Object, Object>> iterator() {
            return new AbstractIterator<Map.Entry<Object, Object>>() {
                int i = 0;

                @Override
                protected Map.Entry<Object, Object> computeNext() {
                    if (i >= ids.length)
                        return endOfData();
                    final Object id = ids[i++];
                    String key = id.toString();
                    final Object value = object.get(id);
                    return new AbstractMap.SimpleImmutableEntry<>(key, value);
                }
            };
        }
    };
}