public static <T> List<T> newList() { return newSizedList(10); }
public static <T> List<T> newList() { return newSizedList(10); }
@Override public List<Object> parse(String s) { JSONArray array = JSON.parseArray(s); List<Object> list = C.newSizedList(array.size()); for (Object o : array) { list.add(ValueObject.of(o)); } return list; }
<T extends InterceptorMethodMetaInfo> List<T> convertDerived(List<T> interceptors) { C.List<T> list = C.newSizedList(interceptors.size()); for (InterceptorMethodMetaInfo derived : interceptors) { list.add((T)derived.extended(this)); } return list; }
@Override public List<Object> parse(String s) { JSONArray array = JSON.parseArray(s); List<Object> list = C.newSizedList(array.size()); for (Object o : array) { list.add(ValueObject.of(o)); } return list; }
<T extends InterceptorMethodMetaInfo> List<T> convertDerived(List<T> interceptors) { C.List<T> list = C.newSizedList(interceptors.size()); for (InterceptorMethodMetaInfo derived : interceptors) { list.add((T)derived.extended(this)); } return list; }
@SuppressWarnings("unchecked") private static List<Class<? extends Exception>> exceptionClassesOf(CatchMethodMetaInfo metaInfo) { List<String> classNames = metaInfo.exceptionClasses(); List<Class<? extends Exception>> clsList; clsList = C.newSizedList(classNames.size()); App app = Act.app(); for (String cn : classNames) { clsList.add((Class) app.classForName(cn)); } return clsList; }
@SuppressWarnings("unchecked") private static List<Class<? extends Exception>> exceptionClassesOf(CatchMethodMetaInfo metaInfo) { List<String> classNames = metaInfo.exceptionClasses(); List<Class<? extends Exception>> clsList; clsList = C.newSizedList(classNames.size()); App app = Act.app(); for (String cn : classNames) { clsList.add((Class) app.classForName(cn)); } return clsList; }
public C.List<T> unique(Comparator<T> comp) { Set<T> set = new TreeSet<T>(comp); C.List<T> retList = null; int i = 0; for (T t: this) { i++; if (set.contains(t)) { if (null == retList) { retList = C.newSizedList(size()); retList.addAll(subList(0, i - 1)); } } else if (null != retList) { retList.add(t); } set.add(t); } return null == retList ? this : retList; }
public C.List<T> unique(Comparator<T> comp) { Set<T> set = new TreeSet<T>(comp); C.List<T> retList = null; int i = 0; for (T t: this) { i++; if (set.contains(t)) { if (null == retList) { retList = C.newSizedList(size()); retList.addAll(subList(0, i - 1)); } } else if (null != retList) { retList.add(t); } set.add(t); } return null == retList ? this : retList; }
public static <T> List<T> collect(Iterable source, String propertyPath) { if (null == source) { return C.list(); } int sz = 10; if (source instanceof Collection) { sz = ((Collection) source).size(); if (0 == sz) { return C.list(); } } List<T> retList = newSizedList(sz); for (Object o: source) { retList.add((T) $.getProperty(o, propertyPath)); } return retList; }
static <T> Provider<T> decorate(BeanSpec spec, Provider<T> realProvider, Genie genie) { if (realProvider instanceof PostConstructorInvoker) { return realProvider; } Set<Annotation> postProcessors = spec.postProcessors(); if (postProcessors.isEmpty()) { return realProvider; } C.List<$.T2<Annotation, PostConstructProcessor<T>>> processors = C.newSizedList(postProcessors.size()); for (Annotation annotation : postProcessors) { PostConstructProcessor<T> pcp = genie.postConstructProcessor(annotation); processors.add($.T2(annotation, pcp)); } return new PostConstructProcessorInvoker<>(realProvider, processors); } }
@Override public C.List<T> tail() { int sz = size(); if (0 == sz) { throw new UnsupportedOperationException(); } if (isImmutable()) { return subList(1, sz); } C.List<T> l = C.newSizedList(sz - 1); l.addAll(subList(1, sz)); return l; }
static <T> Provider<T> decorate(BeanSpec spec, Provider<T> realProvider, Genie genie) { if (realProvider instanceof PostConstructorInvoker) { return realProvider; } Set<Annotation> postProcessors = spec.postProcessors(); if (postProcessors.isEmpty()) { return realProvider; } C.List<$.T2<Annotation, PostConstructProcessor<T>>> processors = C.newSizedList(postProcessors.size()); for (Annotation annotation : postProcessors) { PostConstructProcessor<T> pcp = genie.postConstructProcessor(annotation); processors.add($.T2(annotation, pcp)); } return new PostConstructProcessorInvoker<>(realProvider, processors); } }
public static <T> List<T> collect(Iterable source, String propertyPath) { if (null == source) { return C.list(); } int sz = 10; if (source instanceof Collection) { sz = ((Collection) source).size(); if (0 == sz) { return C.list(); } } List<T> retList = newSizedList(sz); for (Object o: source) { retList.add((T) $.getProperty(o, propertyPath)); } return retList; }
@Override public C.List<T> unique() { Set<T> set = C.newSet(); C.List<T> retList = null; int i = 0; for (T t: this) { i++; if (set.contains(t)) { if (null == retList) { retList = C.newSizedList(size()); retList.addAll(subList(0, i - 1)); } } else if (null != retList) { retList.add(t); } set.add(t); } return null == retList ? this : retList; }
@Override public C.List<T> tail() { int sz = size(); if (0 == sz) { throw new UnsupportedOperationException(); } if (isImmutable()) { return subList(1, sz); } C.List<T> l = C.newSizedList(sz - 1); l.addAll(subList(1, sz)); return l; }
private void check(Map<String, Long> newTimestamps) { C.List<FsEvent> events = C.newSizedList(3); C.Set<String> set0 = C.set(timestamps.keySet()); C.Set<String> set1 = C.set(newTimestamps.keySet()); C.Set<String> added = set1.without(set0); if (!added.isEmpty()) { events.add(createEvent(FsEvent.Kind.CREATE, added)); } C.Set<String> removed = set0.without(set1); if (!removed.isEmpty()) { events.add(createEvent(FsEvent.Kind.DELETE, removed)); } C.Set<String> retained = set1.withIn(set0); C.Set<String> modified = modified(retained, newTimestamps); if (!modified.isEmpty()) { events.add(createEvent(FsEvent.Kind.MODIFY, modified)); } if (!events.isEmpty()) { trigger(events.toArray(new FsEvent[events.size()])); } }
@Override public C.List<T> append(T t) { if (isMutable()) { add(t); return this; } // Immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() + 1); lb.addAll(this); lb.add(t); return lb.toList(); } // mutable but readonly C.List<T> l = C.newSizedList(size() + 1); l.addAll(this); l.add(t); return l; }
private C.List<T> unLazyPrepend(Iterable<? extends T> iterable) { if (isMutable()) { int pos = 0; for (T t : iterable) { add(pos++, t); } return this; } // immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(iterable).append(this); return lb.toList(); } // mutable but read only C.List<T> l = C.newSizedList(size() * 2); l.addAll(iterable); l.addAll(this); return l; }