Java Queue Usage get(Queue queue, int index)

Here you can find the source of get(Queue queue, int index)

Description

get

License

Open Source License

Declaration

public static <E> E get(Queue<E> queue, int index) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Queue;

public class Main {

    public static <E> E get(Queue<E> queue, int index) {
        E result = null;/*from   www  .ja v a 2 s. co m*/
        int i = 0;
        for (E e : queue) {
            if (i == index) {
                result = e;
                break;
            }
            i++;
        }
        return result;
    }
}

Related

  1. addStringArraytoQueue(Queue set, String[] array)
  2. asString(Queue values)
  3. bQToString(Queue bQ)
  4. convertQueueToArray(Queue q)
  5. elementFail(Queue q)
  6. getAllElementsFromQueueAsList(Queue queue)
  7. isListBased(Class type)
  8. isQueue(final Object value, final boolean acceptNull)
  9. loadBalancingLeftHeavy(List tasks, int size)

  10. HOME | Copyright © www.java2s.com 2016