Example usage for java.util ArrayDeque ArrayDeque

List of usage examples for java.util ArrayDeque ArrayDeque

Introduction

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

Prototype

public ArrayDeque(Collection<? extends E> c) 

Source Link

Document

Constructs a deque containing the elements of the specified collection, in the order they are returned by the collection's iterator.

Usage

From source file:Main.java

public static <E> ArrayDeque<E> createArrayDeque(Collection<? extends E> collection) {
    if (collection == null) {
        return null;
    }//from w w  w .  j  a  va2 s  .  co m

    return new ArrayDeque<E>(collection);
}

From source file:Main.java

public static <E> ArrayDeque<E> getArrayQueue(int initialCapacity) {
    return new ArrayDeque<E>(initialCapacity);
}

From source file:Main.java

public static <E> ArrayDeque<E> getArrayDeque(int initialCapacity) {
    return new ArrayDeque<E>(initialCapacity);
}

From source file:Main.java

public static <E> ArrayDeque<E> createArrayDeque(int initialCapacity) {
    return new ArrayDeque<E>(initialCapacity);
}

From source file:Main.java

public static <E> ArrayDeque<E> newArrayDeque(final Collection<? extends E> c) {
    return new ArrayDeque<E>(c);
}

From source file:Main.java

public static <E> ArrayDeque<E> newArrayDeque(final int numElements) {
    return new ArrayDeque<E>(numElements);
}

From source file:io.apiman.gateway.engine.vertx.polling.fetchers.auth.AbstractOAuth2Base.java

protected static JsonObject mapToJson(Map<String, String> map) {
    JsonObject root = new JsonObject();
    for (Entry<String, String> entry : map.entrySet()) {
        String[] split = StringUtils.split(entry.getKey(), '.');
        ArrayDeque<String> dq = new ArrayDeque<>(Arrays.asList(split));
        createOrDescend(root, dq, entry.getValue());
    }//from   w  ww . ja v a2  s  .  co m
    return root;
}

From source file:org.apache.gobblin.HttpTestUtils.java

public static Queue<BufferedRecord<GenericRecord>> createQueue(int size, boolean isHttpOperation) {
    Queue<BufferedRecord<GenericRecord>> queue = new ArrayDeque<>(size);
    for (int i = 0; i < size; i++) {
        Map<String, String> keys = new HashMap<>();
        keys.put("part1", i + "1");
        keys.put("part2", i + "2");
        Map<String, String> queryParams = new HashMap<>();
        queryParams.put("param1", i + "1");
        GenericRecord record = isHttpOperation ? new HttpOperation() : new MockGenericRecord();
        record.put("keys", keys);
        record.put("queryParams", queryParams);
        record.put("body", "{\"id\":\"id" + i + "\"}");
        BufferedRecord<GenericRecord> item = new BufferedRecord<>(record, null);
        queue.add(item);/*w  ww.j  av  a2  s. c  o m*/
    }
    return queue;
}

From source file:com.espertech.esper.core.start.EPStatementDestroyCallbackList.java

public void addCallback(DestroyCallback destroyCallback) {
    if (callbacks == null) {
        callbacks = new ArrayDeque<DestroyCallback>(2);
    }// w  w w  .  jav  a2s. c o m
    callbacks.add(destroyCallback);
}

From source file:org.polymap.rhei.batik.engine.PanelContextInjector.java

@Override
public void run() {
    Queue<Class> types = new ArrayDeque(16);
    types.add(panel.getClass());//from  w  w w.j a v a 2 s  .  co m

    while (!types.isEmpty()) {
        Class type = types.remove();
        if (type.getSuperclass() != null) {
            types.add(type.getSuperclass());
        }

        for (Field f : type.getDeclaredFields()) {
            // ContextProperty
            if (Context.class.isAssignableFrom(f.getType())) {
                f.setAccessible(true);
                Type ftype = f.getGenericType();
                if (ftype instanceof ParameterizedType) {
                    // set
                    try {
                        f.set(panel, new ContextPropertyInstance(f, context));
                        log.debug("injected: " + f.getName() + " (" + panel.getClass().getSimpleName() + ")");
                        continue;
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                } else {
                    throw new IllegalStateException("ContextProperty has no type param: " + f.getName());
                }
            }

            // @Context annotation
            Scope annotation = f.getAnnotation(Scope.class);
            if (annotation != null) {
                f.setAccessible(true);
                throw new UnsupportedOperationException("Injecting context property as direct member.");

                //                    Object value = context.get( f.getType() );
                //
                //                    try {
                //                        f.set( panel, value );
                //                        log.info( "injected: " + f.getName() + " <- " + value );
                //                    }
                //                    catch (Exception e) {
                //                        throw new RuntimeException( e );
                //                    }
            }
        }
    }
}