Search in sources :

Example 41 with ListIterator

use of java.util.ListIterator in project Lucee by lucee.

the class Every method invoke.

private static boolean invoke(PageContext pc, List list, UDF udf, ExecutorService es, List<Future<Data<Object>>> futures) throws CasterException, PageException {
    ListIterator it = list.listIterator();
    boolean async = es != null;
    Object res, v;
    int index;
    ArgumentIntKey k;
    while (it.hasNext()) {
        index = it.nextIndex();
        k = ArgumentIntKey.init(index);
        v = it.next();
        res = _inv(pc, udf, new Object[] { v, Caster.toDoubleValue(k.getString()), list }, k, v, es, futures);
        if (!async && !Caster.toBooleanValue(res))
            return false;
    }
    return true;
}
Also used : ArgumentIntKey(lucee.runtime.type.scope.ArgumentIntKey) ListIterator(java.util.ListIterator)

Example 42 with ListIterator

use of java.util.ListIterator in project Lucee by lucee.

the class Filter method invoke.

private static Collection invoke(PageContext pc, List list, UDF udf, ExecutorService es, List<Future<Data<Pair<Object, Object>>>> futures) throws CasterException, PageException {
    Array rtn = new ArrayImpl();
    ListIterator it = list.listIterator();
    boolean async = es != null;
    Object res, v;
    int index;
    ArgumentIntKey k;
    while (it.hasNext()) {
        index = it.nextIndex();
        k = ArgumentIntKey.init(index);
        v = it.next();
        res = _inv(pc, udf, new Object[] { v, Caster.toDoubleValue(k.getString()), list }, k, v, es, futures);
        if (!async && Caster.toBooleanValue(res))
            rtn.append(v);
    }
    return rtn;
}
Also used : Array(lucee.runtime.type.Array) ArrayImpl(lucee.runtime.type.ArrayImpl) ArgumentIntKey(lucee.runtime.type.scope.ArgumentIntKey) ListIterator(java.util.ListIterator)

Example 43 with ListIterator

use of java.util.ListIterator in project Lucee by lucee.

the class Reduce method invoke.

private static Object invoke(PageContext pc, List list, UDF udf, Object initalValue) throws CasterException, PageException {
    ListIterator it = list.listIterator();
    Object v;
    int index;
    ArgumentIntKey k;
    while (it.hasNext()) {
        index = it.nextIndex();
        k = ArgumentIntKey.init(index);
        v = it.next();
        initalValue = udf.call(pc, new Object[] { initalValue, v, Caster.toDoubleValue(k.getString()), list }, true);
    }
    return initalValue;
}
Also used : ArgumentIntKey(lucee.runtime.type.scope.ArgumentIntKey) ListIterator(java.util.ListIterator)

Example 44 with ListIterator

use of java.util.ListIterator in project Lucee by lucee.

the class Some method invoke.

private static boolean invoke(PageContext pc, List list, UDF udf, ExecutorService es, List<Future<Data<Object>>> futures) throws CasterException, PageException {
    ListIterator it = list.listIterator();
    boolean async = es != null;
    Object res, v;
    int index;
    ArgumentIntKey k;
    while (it.hasNext()) {
        index = it.nextIndex();
        k = ArgumentIntKey.init(index);
        v = it.next();
        res = _inv(pc, udf, new Object[] { v, Caster.toDoubleValue(k.getString()), list }, k, v, es, futures);
        if (!async && Caster.toBooleanValue(res))
            return true;
    }
    return false;
}
Also used : ArgumentIntKey(lucee.runtime.type.scope.ArgumentIntKey) ListIterator(java.util.ListIterator)

Example 45 with ListIterator

use of java.util.ListIterator in project Lucee by lucee.

the class ArrayUtil method sizeOf.

public static long sizeOf(List list) {
    ListIterator it = list.listIterator();
    long size = 0;
    while (it.hasNext()) {
        size += SizeOf.size(it.next());
    }
    return size;
}
Also used : ListIterator(java.util.ListIterator)

Aggregations

ListIterator (java.util.ListIterator)121 ArrayList (java.util.ArrayList)42 List (java.util.List)41 LinkedList (java.util.LinkedList)26 Iterator (java.util.Iterator)21 Map (java.util.Map)12 Handler (com.sun.jsftemplating.annotation.Handler)8 AbstractList (java.util.AbstractList)7 HashMap (java.util.HashMap)7 AbstractSequentialList (java.util.AbstractSequentialList)6 IOException (java.io.IOException)5 RandomAccess (java.util.RandomAccess)5 SelectResults (org.apache.geode.cache.query.SelectResults)5 Test (org.junit.Test)5 File (java.io.File)4 HashSet (java.util.HashSet)4 NoSuchElementException (java.util.NoSuchElementException)4 SipURI (javax.sip.address.SipURI)4 ArgumentIntKey (lucee.runtime.type.scope.ArgumentIntKey)4 StructTypeImpl (org.apache.geode.cache.query.internal.types.StructTypeImpl)4