Java Code Examples for org.osgl.util.C#newSizedList()
The following examples show how to use
org.osgl.util.C#newSizedList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FsChangeDetector.java From actframework with Apache License 2.0 | 6 votes |
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()])); } }
Example 2
Source File: PostConstructProcessorInvoker.java From java-di with Apache License 2.0 | 5 votes |
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); }
Example 3
Source File: ListCodec.java From actframework with Apache License 2.0 | 5 votes |
@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; }
Example 4
Source File: ControllerClassMetaInfo.java From actframework with Apache License 2.0 | 5 votes |
<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; }
Example 5
Source File: EndPointTestContext.java From actframework with Apache License 2.0 | 5 votes |
public EndPointTestContext params(String key, Object val, Object ... otherPairs) { E.illegalArgumentIf(otherPairs.length % 2 != 0); this.params = C.newSizedList(1 + otherPairs.length / 2); this.params.add($.T2(key, val)); for (int i = 0; i < otherPairs.length - 1; ++i) { this.params.add($.T2(S.string(otherPairs[i]), otherPairs[i+1])); } return this; }