javatips.net counter

Java Examples for java.util.ArrayList

The following java examples will help you to understand the usage of java.util.ArrayList. These source code samples are taken from different open source projects.

Example 1
Project: gluster-ovirt-poc-master  File: ImagesSyncronizer.java View source code
public void Syncronize() {
    /**
         * Get All Images from IRS
         */
    java.util.ArrayList<Guid> imagesIdsFromIrs = GetImagesFromIrs();
    java.util.ArrayList<Guid> inVdcButNotInIrs = new java.util.ArrayList<Guid>();
    List<DiskImage> imagesFromVdc = GetImagesFromVdc();
    for (DiskImage image : imagesFromVdc) {
        if (!imagesIdsFromIrs.contains(image.getId()) && image.getimageStatus() != ImageStatus.ILLEGAL) {
            inVdcButNotInIrs.add(image.getId());
        } else {
            imagesIdsFromIrs.remove(image.getId());
        }
    }
    java.util.ArrayList<Guid> imageIdsFromIrsNotInVdc = new java.util.ArrayList<Guid>();
    for (Guid imageId : imagesIdsFromIrs) {
        // todo - omer what parameters to send here? and why this code runs
        // again?!
        DiskImage imageFromIrs = (DiskImage) Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.GetImageInfo, new GetImageInfoVDSCommandParameters(Guid.Empty, Guid.Empty, Guid.Empty, imageId)).getReturnValue();
        if (imageFromIrs.getimageStatus() != ImageStatus.ILLEGAL) {
            imageIdsFromIrsNotInVdc.add(imageId);
        }
    }
    /**
         * Remove all images, found in Irs and not found in Vdc
         */
    ProceedImagesNotFoundInVdc(imageIdsFromIrsNotInVdc);
    ProceedImagesNotFoundInIrs(inVdcButNotInIrs);
}
Example 2
Project: iterator-master  File: Integer.java View source code
public static java.lang.Object decode_(com.jsoniter.JsonIterator iter) throws java.io.IOException {
    java.util.ArrayList col = (java.util.ArrayList) com.jsoniter.CodegenAccess.resetExistingObject(iter);
    if (iter.readNull()) {
        com.jsoniter.CodegenAccess.resetExistingObject(iter);
        return null;
    }
    if (!com.jsoniter.CodegenAccess.readArrayStart(iter)) {
        return col == null ? new java.util.ArrayList(0) : (java.util.ArrayList) com.jsoniter.CodegenAccess.reuseCollection(col);
    }
    Object a1 = (java.lang.Integer) java.lang.Integer.valueOf(iter.readInt());
    if (com.jsoniter.CodegenAccess.nextToken(iter) != ',') {
        java.util.ArrayList obj = col == null ? new java.util.ArrayList(1) : (java.util.ArrayList) com.jsoniter.CodegenAccess.reuseCollection(col);
        obj.add(a1);
        return obj;
    }
    Object a2 = (java.lang.Integer) java.lang.Integer.valueOf(iter.readInt());
    if (com.jsoniter.CodegenAccess.nextToken(iter) != ',') {
        java.util.ArrayList obj = col == null ? new java.util.ArrayList(2) : (java.util.ArrayList) com.jsoniter.CodegenAccess.reuseCollection(col);
        obj.add(a1);
        obj.add(a2);
        return obj;
    }
    Object a3 = (java.lang.Integer) java.lang.Integer.valueOf(iter.readInt());
    if (com.jsoniter.CodegenAccess.nextToken(iter) != ',') {
        java.util.ArrayList obj = col == null ? new java.util.ArrayList(3) : (java.util.ArrayList) com.jsoniter.CodegenAccess.reuseCollection(col);
        obj.add(a1);
        obj.add(a2);
        obj.add(a3);
        return obj;
    }
    Object a4 = (java.lang.Integer) java.lang.Integer.valueOf(iter.readInt());
    java.util.ArrayList obj = col == null ? new java.util.ArrayList(8) : (java.util.ArrayList) com.jsoniter.CodegenAccess.reuseCollection(col);
    obj.add(a1);
    obj.add(a2);
    obj.add(a3);
    obj.add(a4);
    while (com.jsoniter.CodegenAccess.nextToken(iter) == ',') {
        obj.add((java.lang.Integer) java.lang.Integer.valueOf(iter.readInt()));
    }
    return obj;
}
Example 3
Project: mvel-master  File: UnsupportedFeaturesTests.java View source code
public void testJavaStyleClassLiterals() {
    MVEL.COMPILER_OPT_SUPPORT_JAVA_STYLE_CLASS_LITERALS = true;
    OptimizerFactory.setDefaultOptimizer("ASM");
    assertEquals(String.class, MVEL.executeExpression(MVEL.compileExpression("String.class")));
    OptimizerFactory.setDefaultOptimizer("reflective");
    assertEquals(String.class, MVEL.executeExpression(MVEL.compileExpression("String.class")));
    OptimizerFactory.setDefaultOptimizer(OptimizerFactory.DYNAMIC);
    assertEquals(String.class, MVEL.eval("String"));
    assertEquals(String.class, MVEL.eval("java.lang.String"));
    assertEquals(java.util.ArrayList.class, MVEL.eval("java.util.ArrayList"));
    assertEquals(String.class, MVEL.eval("(String)"));
    assertEquals(String.class, MVEL.eval("(java.lang.String)"));
    assertEquals(java.util.ArrayList.class, MVEL.eval("(java.util.ArrayList)"));
    assertEquals(String.class, MVEL.eval("(String.class)"));
    assertEquals(String.class, MVEL.eval("(java.lang.String.class)"));
    assertEquals(java.util.ArrayList.class, MVEL.eval("(java.util.ArrayList.class)"));
    assertEquals(String.class, MVEL.eval("String.class"));
    assertEquals(String.class, MVEL.eval("java.lang.String.class"));
    assertEquals(java.util.ArrayList.class, MVEL.eval("java.util.ArrayList.class"));
    assertEquals(Class.class, MVEL.analyze("String", ParserContext.create()));
    assertEquals(Class.class, MVEL.analyze("String.class", ParserContext.create()));
    assertEquals(Class.class, MVEL.analyze("java.lang.String.class", ParserContext.create()));
    assertEquals(Class.class, MVEL.analyze("java.util.ArrayList.class", ParserContext.create()));
    MVEL.COMPILER_OPT_SUPPORT_JAVA_STYLE_CLASS_LITERALS = false;
}
Example 4
Project: ovirt-engine-master  File: VdcReturnValueBase_CustomFieldSerializer.java View source code
public static void deserialize(SerializationStreamReader streamReader, VdcReturnValueBase instance) throws SerializationException {
    instance.setValid(streamReader.readBoolean());
    java.util.ArrayList<String> validationMessages = (java.util.ArrayList<String>) streamReader.readObject();
    instance.setValidationMessages(validationMessages);
    java.util.ArrayList<String> executeFailedMessages = (java.util.ArrayList<String>) streamReader.readObject();
    instance.setExecuteFailedMessages(executeFailedMessages);
    instance.setSucceeded(streamReader.readBoolean());
    instance.setIsSyncronious(streamReader.readBoolean());
    instance.setActionReturnValue(streamReader.readObject());
    instance.setDescription(streamReader.readString());
    java.util.ArrayList<Guid> asyncTaskIdList = (java.util.ArrayList<Guid>) streamReader.readObject();
    instance.setTaskPlaceHolderIdList(asyncTaskIdList);
    java.util.ArrayList<Guid> taskIdList = (java.util.ArrayList<Guid>) streamReader.readObject();
    instance.setVdsmTaskIdList(taskIdList);
    instance.setEndActionTryAgain(streamReader.readBoolean());
    instance.setFault((EngineFault) streamReader.readObject());
}
Example 5
Project: eclipse.jdt.debug-master  File: VariableDeclarationTests.java View source code
// java.util.ArrayList
public void testArrayList() throws Throwable {
    try {
        init();
        IValue value = eval("java.util.ArrayList i= new java.util.ArrayList(); return i;");
        String typeName = value.getReferenceTypeName();
        assertEquals("java.util.ArrayList : wrong type : ", "java.util.ArrayList", Signature.getTypeErasure(typeName));
    } finally {
        end();
    }
}
Example 6
Project: Emby.ApiClient.Java-master  File: SubtitleProfile.java View source code
public final boolean SupportsLanguage(String subLanguage) {
    if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(getLanguage())) {
        return true;
    }
    if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(subLanguage)) {
        subLanguage = "und";
    }
    java.util.ArrayList<String> languages = GetLanguages();
    return languages.isEmpty() || ListHelper.ContainsIgnoreCase(languages, subLanguage);
}
Example 7
Project: fb-contrib-eclipse-quick-fixes-master  File: ImportUtil.java View source code
public static String[] filterOutJavaLangImports(String[] addedImports) {
    ArrayList<String> filteredImports = new ArrayList<>();
    for (String oldImport : addedImports) {
        if (oldImport.startsWith("java.lang")) {
            continue;
        }
        filteredImports.add(oldImport);
    }
    return filteredImports.toArray(new String[filteredImports.size()]);
}
Example 8
Project: hive_blinkdb-master  File: GroupByDesc.java View source code
/**
   * Checks if this grouping is like distinct, which means that all non-distinct grouping
   * columns behave like they were distinct - for example min and max operators.
   */
public boolean isDistinctLike() {
    ArrayList<AggregationDesc> aggregators = getAggregators();
    for (AggregationDesc ad : aggregators) {
        if (!ad.getDistinct()) {
            GenericUDAFEvaluator udafEval = ad.getGenericUDAFEvaluator();
            UDFType annot = udafEval.getClass().getAnnotation(UDFType.class);
            if (annot == null || !annot.distinctLike()) {
                return false;
            }
        }
    }
    return true;
}
Example 9
Project: la-clojure-master  File: ClojureClassNameCompletionTest.java View source code
public void testSimpleClassName() throws IOException {
    String fileText = "(ArrayList<caret>)";
    configureFromFileText("dummy.clj", fileText);
    final CompleteResult complete = complete(2);
    String resultText = "(ns dummy.clj\n" + "  (:import [java.util ArrayList]))\n" + "\n" + "(ArrayList<caret>)";
    completeLookupItem(complete.getElements()[0]);
    checkResultByText(resultText);
}
Example 10
Project: EasyMPermission-master  File: DelegateOnGetter.java View source code
@Delegate
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public Bar getBar() {
    java.lang.Object value = this.bar.get();
    if ((value == null)) {
        synchronized (this.bar) {
            value = this.bar.get();
            if ((value == null)) {
                final Bar actualValue = new Bar() {

                    x() {
                        super();
                    }

                    public void setList(java.util.ArrayList<String> list) {
                    }

                    public int getInt() {
                        return 42;
                    }
                };
                value = ((actualValue == null) ? this.bar : actualValue);
                this.bar.set(value);
            }
        }
    }
    return (Bar) ((value == this.bar) ? null : value);
}
Example 11
Project: coding2017-master  File: ArrayListTest.java View source code
@Test
public void test01() {
    ArrayList arrayList = new ArrayList();
    arrayList.add(1);
    arrayList.add(100);
    arrayList.add(0, 1000);
    System.out.println(arrayList.size());
    for (int i = 0; i < arrayList.size(); i++) {
        System.out.println(arrayList.get(i));
    }
    arrayList.remove(0);
    System.out.println(arrayList.size());
    for (int i = 0; i < arrayList.size(); i++) {
        System.out.println(arrayList.get(i));
    }
}
Example 12
Project: buck-master  File: TypeResolverTest.java View source code
@Test
public void testParameterizedTypeResolves() throws IOException {
    compile(Joiner.on('\n').join("abstract class Foo extends java.util.ArrayList<java.lang.String> { }", "abstract class Bar extends java.util.ArrayList<java.lang.String> { }"));
    TypeElement listElement = elements.getTypeElement("java.util.ArrayList");
    TypeElement stringElement = elements.getTypeElement("java.lang.String");
    DeclaredType expectedSuperclass = types.getDeclaredType(listElement, stringElement.asType());
    TypeElement fooElement = elements.getTypeElement("Foo");
    TypeElement barElement = elements.getTypeElement("Bar");
    DeclaredType fooSuperclass = (DeclaredType) fooElement.getSuperclass();
    DeclaredType barSuperclass = (DeclaredType) barElement.getSuperclass();
    assertNotSame(expectedSuperclass, fooSuperclass);
    assertSameType(expectedSuperclass, fooSuperclass);
    assertSameType(fooSuperclass, barSuperclass);
}
Example 13
Project: platform_build-master  File: TypeResolverTest.java View source code
@Test
public void testParameterizedTypeResolves() throws IOException {
    compile(Joiner.on('\n').join("abstract class Foo extends java.util.ArrayList<java.lang.String> { }", "abstract class Bar extends java.util.ArrayList<java.lang.String> { }"));
    TypeElement listElement = elements.getTypeElement("java.util.ArrayList");
    TypeElement stringElement = elements.getTypeElement("java.lang.String");
    DeclaredType expectedSuperclass = types.getDeclaredType(listElement, stringElement.asType());
    TypeElement fooElement = elements.getTypeElement("Foo");
    TypeElement barElement = elements.getTypeElement("Bar");
    DeclaredType fooSuperclass = (DeclaredType) fooElement.getSuperclass();
    DeclaredType barSuperclass = (DeclaredType) barElement.getSuperclass();
    assertNotSame(expectedSuperclass, fooSuperclass);
    assertSameType(expectedSuperclass, fooSuperclass);
    assertSameType(fooSuperclass, barSuperclass);
}
Example 14
Project: mwe-master  File: ContentAssistTest.java View source code
@Test
public void testReplaceRegion_01() throws Exception {
    String javaUtilArrayList = "java.util.ArrayList";
    ICompletionProposal[] proposals = newBuilder().append(javaUtilArrayList).computeCompletionProposals(javaUtilArrayList);
    for (ICompletionProposal proposal : proposals) {
        ConfigurableCompletionProposal casted = (ConfigurableCompletionProposal) proposal;
        int replaceContextLength = casted.getReplaceContextLength();
        assertEquals(javaUtilArrayList.length(), replaceContextLength);
    }
}
Example 15
Project: lombok-intellij-plugin-master  File: BuilderSingularRedirectToGuava.java View source code
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public BuilderSingularRedirectToGuavaBuilder things(final java.util.Map<? extends Integer, ? extends Number> things) {
    if (this.things$key == null) {
        this.things$key = new java.util.ArrayList<Integer>();
        this.things$value = new java.util.ArrayList<Number>();
    }
    for (final java.util.Map.Entry<? extends Integer, ? extends Number> $lombokEntry : things.entrySet()) {
        this.things$key.add($lombokEntry.getKey());
        this.things$value.add($lombokEntry.getValue());
    }
    return this;
}
Example 16
Project: lombok-master  File: BuilderSingularWithPrefixes.java View source code
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public BuilderSingularWithPrefixes build() {
    java.util.List<String> elems;
    switch(((this.elems == null) ? 0 : this.elems.size())) {
        case 0:
            elems = java.util.Collections.emptyList();
            break;
        case 1:
            elems = java.util.Collections.singletonList(this.elems.get(0));
            break;
        default:
            elems = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.elems));
    }
    return new BuilderSingularWithPrefixes(elems);
}
Example 17
Project: lombok-pg-master  File: DelegateOnGetter.java View source code
@Delegate
@java.lang.SuppressWarnings("all")
public Bar getBar() {
    java.util.concurrent.atomic.AtomicReference<Bar> value = this.bar.get();
    if ((value == null)) {
        synchronized (this.bar) {
            value = this.bar.get();
            if ((value == null)) {
                final Bar actualValue = new Bar() {

                    x() {
                        super();
                    }

                    public void setList(java.util.ArrayList<String> list) {
                    }

                    public int getInt() {
                        return 42;
                    }
                };
                value = new java.util.concurrent.atomic.AtomicReference<Bar>(actualValue);
                this.bar.set(value);
            }
        }
    }
    return value.get();
}
Example 18
Project: heapaudit-master  File: TestArrayList.java View source code
// Test allocation of ArrayList.
@Test
public void ArrayList() {
    clear();
    ArrayList<Integer> array = new ArrayList<Integer>();
    for (int i = 0; i < 100; ++i) {
        array.add(i);
    }
    assertTrue(expect("java.util.ArrayList", -1, 24));
    assertTrue(expect("java.lang.Object", 10, 56));
    assertTrue(expect("java.lang.Object", 16, 80));
    assertTrue(expect("java.lang.Object", 25, 120));
    assertTrue(expect("java.lang.Object", 38, 168));
    assertTrue(expect("java.lang.Object", 58, 248));
    assertTrue(expect("java.lang.Object", 88, 368));
    assertTrue(expect("java.lang.Object", 133, 552));
    assertTrue(empty());
}
Example 19
Project: intellij-generator-plugin-master  File: TypeToTextFactory.java View source code
public static TypeToTextMapping createDefaultVariableInitialization() {
    return new TypeToTextMapping().put("java.util.Collection", "java.util.Collections." + GENERICS_PLACEHOLDER + "emptySet()", true).put("java.util.Set", "java.util.Collections." + GENERICS_PLACEHOLDER + "emptySet()", true).put("java.util.List", "java.util.Collections." + GENERICS_PLACEHOLDER + "emptyList()", true).put("java.util.ArrayList", "new java.util.ArrayList" + GENERICS_PLACEHOLDER + "()", true).put("java.util.SortedSet", "new java.util.TreeSet" + GENERICS_PLACEHOLDER + "()", true).put("java.util.HashSet", "new java.util.HashSet" + GENERICS_PLACEHOLDER + "()", true).put("java.util.LinkedHashSet", "new java.util.LinkedHashSet" + GENERICS_PLACEHOLDER + "()", true).put("java.util.HashMap", "new java.util.HashMap" + GENERICS_PLACEHOLDER + "()", false);
}
Example 20
Project: wss4j-master  File: ResultsOrderTest.java View source code
/**
     */
@Test
public void testOrder() throws Exception {
    CustomHandler handler = new CustomHandler();
    java.util.List<WSSecurityEngineResult> results = new java.util.ArrayList<WSSecurityEngineResult>();
    results.add(new WSSecurityEngineResult(WSConstants.UT));
    results.add(new WSSecurityEngineResult(WSConstants.TS));
    results.add(new WSSecurityEngineResult(WSConstants.SC));
    results.add(new WSSecurityEngineResult(WSConstants.SIGN));
    java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
    actions.add(WSConstants.UT);
    actions.add(WSConstants.TS);
    actions.add(WSConstants.SIGN);
    assertTrue(handler.checkResults(results, actions));
    assertTrue(handler.checkResultsAnyOrder(results, actions));
}
Example 21
Project: android-libcore64-master  File: ArrayListTest.java View source code
/**
     * java.util.ArrayList#ArrayList(java.util.Collection)
     */
public void test_ConstructorLjava_util_Collection() {
    // Test for method java.util.ArrayList(java.util.Collection)
    ArrayList al = new ArrayList(Arrays.asList(objArray));
    assertTrue("arrayList created from collection has incorrect size", al.size() == objArray.length);
    for (int counter = 0; counter < objArray.length; counter++) assertTrue("arrayList created from collection has incorrect elements", al.get(counter) == objArray[counter]);
    try {
        new ArrayList(null);
        fail("NullPointerException expected");
    } catch (NullPointerException e) {
    }
}
Example 22
Project: android_platform_libcore-master  File: ArrayListTest.java View source code
/**
     * java.util.ArrayList#ArrayList(java.util.Collection)
     */
public void test_ConstructorLjava_util_Collection() {
    // Test for method java.util.ArrayList(java.util.Collection)
    ArrayList al = new ArrayList(Arrays.asList(objArray));
    assertTrue("arrayList created from collection has incorrect size", al.size() == objArray.length);
    for (int counter = 0; counter < objArray.length; counter++) assertTrue("arrayList created from collection has incorrect elements", al.get(counter) == objArray[counter]);
    try {
        new ArrayList(null);
        fail("NullPointerException expected");
    } catch (NullPointerException e) {
    }
}
Example 23
Project: robovm-master  File: ArrayListTest.java View source code
/**
     * java.util.ArrayList#ArrayList(java.util.Collection)
     */
public void test_ConstructorLjava_util_Collection() {
    // Test for method java.util.ArrayList(java.util.Collection)
    ArrayList al = new ArrayList(Arrays.asList(objArray));
    assertTrue("arrayList created from collection has incorrect size", al.size() == objArray.length);
    for (int counter = 0; counter < objArray.length; counter++) assertTrue("arrayList created from collection has incorrect elements", al.get(counter) == objArray[counter]);
    try {
        new ArrayList(null);
        fail("NullPointerException expected");
    } catch (NullPointerException e) {
    }
}
Example 24
Project: actor-platform-master  File: StringMatcher.java View source code
public static List<StringMatch> findMatches(String text, String query) {
    text = text.toLowerCase();
    query = query.toLowerCase();
    ArrayList<StringMatch> matches = new ArrayList<StringMatch>();
    if (text.startsWith(query)) {
        matches.add(new StringMatch(0, query.length()));
    }
    int index = text.indexOf(" " + query);
    if (index >= 0) {
        matches.add(new StringMatch(index + 1, query.length()));
    }
    return matches;
}
Example 25
Project: aima-java-master  File: RabbitEyeDataSet.java View source code
@Override
public void setTargetColumns() {
    // assumed that data from file has been pre processed
    // TODO this should be
    // somewhere else,in the
    // super class.
    // Type != class Aargh! I want more
    // powerful type systems
    targetColumnNumbers = new ArrayList<Integer>();
    // using zero based indexing
    targetColumnNumbers.add(1);
}
Example 26
Project: aima-master  File: RabbitEyeDataSet.java View source code
@Override
public void setTargetColumns() {
    // assumed that data from file has been pre processed
    // TODO this should be
    // somewhere else,in the
    // super class.
    // Type != class Aargh! I want more
    // powerful type systems
    targetColumnNumbers = new ArrayList<Integer>();
    // using zero based indexing
    targetColumnNumbers.add(1);
}
Example 27
Project: AlgoDS-master  File: FizzBuzz.java View source code
public List<String> fizzBuzz(int n) {
    List<String> list = new ArrayList<>(n);
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0 && i % 5 == 0)
            list.add("FizzBuzz");
        else if (i % 3 == 0)
            list.add("Fizz");
        else if (i % 5 == 0)
            list.add("Buzz");
        else
            list.add(String.valueOf(i));
    }
    return list;
}
Example 28
Project: android-alternative-video-recorder-master  File: VideoFilter.java View source code
public static String format(ArrayList<VideoFilter> listFilters) {
    StringBuffer result = new StringBuffer();
    Iterator<VideoFilter> it = listFilters.iterator();
    VideoFilter vf;
    while (it.hasNext()) {
        vf = it.next();
        result.append(vf.getFilterString());
        if (it.hasNext())
            result.append(",");
    }
    return result.toString();
}
Example 29
Project: android-ffmpeg-java-master  File: VideoFilter.java View source code
public static String format(ArrayList<VideoFilter> listFilters) {
    StringBuffer result = new StringBuffer();
    Iterator<VideoFilter> it = listFilters.iterator();
    VideoFilter vf;
    while (it.hasNext()) {
        vf = it.next();
        result.append(vf.getFilterString());
        if (it.hasNext())
            result.append(",");
    }
    return result.toString();
}
Example 30
Project: ap-computer-science-master  File: TestHomework2.java View source code
public static void main(String[] args) {
    MyMath2 m = new MyMath2();
    m.createAssignment(8);
    MyScience2 s = new MyScience2();
    s.createAssignment(7);
    MyEnglish2 e = new MyEnglish2();
    e.createAssignment(19);
    MyJava2 j = new MyJava2();
    j.createAssignment(5);
    ArrayList<Homework2> hw = new ArrayList<Homework2>();
    hw.add(m);
    hw.add(s);
    hw.add(e);
    hw.add(j);
    for (Homework2 c : hw) {
        c.doReading();
    }
}
Example 31
Project: archive-commons-master  File: JSONPathSpecFactory.java View source code
public static JSONPathSpec get(String spec) {
    if (spec.contains("|")) {
        // compound OR:
        String parts[] = spec.split("\\|");
        ArrayList<JSONPathSpec> subs = new ArrayList<JSONPathSpec>(parts.length);
        for (String part : parts) {
            subs.add(new SimpleJSONPathSpec(part));
        }
        return new CompoundORJSONPathSpec(subs);
    } else {
        // assume "simple":
        return new SimpleJSONPathSpec(spec);
    }
}
Example 32
Project: asamples-master  File: RadarDataSet.java View source code
@Override
public DataSet copy() {
    ArrayList<Entry> yVals = new ArrayList<Entry>();
    for (int i = 0; i < mYVals.size(); i++) {
        yVals.add(mYVals.get(i).copy());
    }
    RadarDataSet copied = new RadarDataSet(yVals, getLabel());
    copied.mColors = mColors;
    copied.mHighLightColor = mHighLightColor;
    return copied;
}
Example 33
Project: basic-algorithm-operations-master  File: Question.java View source code
public static void main(String[] args) {
    String testString = "mississippi";
    String[] stringList = { "is", "sip", "hi", "sis" };
    SuffixTree tree = new SuffixTree(testString);
    for (String s : stringList) {
        ArrayList<Integer> list = tree.getIndexes(s);
        if (list != null) {
            System.out.println(s + ": " + list.toString());
        }
    }
}
Example 34
Project: BigSemanticsJava-master  File: PersistenceMetaInfo.java View source code
List<ParsedURL> getRawAdditionalLocations() {
    List<MetadataParsedURL> additionalLocations = getAdditionalLocations();
    if (additionalLocations != null) {
        List<ParsedURL> result = new ArrayList<ParsedURL>();
        for (MetadataParsedURL purl : additionalLocations) {
            result.add(purl.getValue());
        }
        return result;
    }
    return null;
}
Example 35
Project: bindgen-master  File: MethodWithGenericsExampleTest.java View source code
public void testReadWrite() {
    MethodWithGenericsExample e = new MethodWithGenericsExample();
    MethodWithGenericsExampleBinding b = new MethodWithGenericsExampleBinding(e);
    List<String> originalList = e.getList();
    Assert.assertSame(originalList, b.list().get());
    b.list().set(new ArrayList<String>());
    Assert.assertNotSame(originalList, b.list().get());
}
Example 36
Project: BusinessCore-master  File: Sorter.java View source code
public static ArrayList<Business> sort() throws ArrayIndexOutOfBoundsException {
    ArrayList<Business> list = new ArrayList<Business>();
    for (Business b : Business.businessList) {
        int i = 0;
        if (list.isEmpty()) {
            list.add(b);
        } else {
            while (b.getBalance() < list.get(i).getBalance()) {
                i++;
            }
            i++;
            list.set(i, b);
        }
    }
    return list;
}
Example 37
Project: carat-master  File: RadarDataSet.java View source code
@Override
public DataSet<Entry> copy() {
    ArrayList<Entry> yVals = new ArrayList<Entry>();
    for (int i = 0; i < mYVals.size(); i++) {
        yVals.add(mYVals.get(i).copy());
    }
    RadarDataSet copied = new RadarDataSet(yVals, getLabel());
    copied.mColors = mColors;
    copied.mHighLightColor = mHighLightColor;
    return copied;
}
Example 38
Project: caxap-master  File: UseListComprehension.java View source code
@Override
public java.util.List<String> getList() {
    java.util.List<String> list = new java.util.ArrayList<>();
    for (String y : new String[] { "d", "", "e", "f", "" }) {
        if (!y.isEmpty()) {
            for (String x : new String[] { "a", "", "b", "c", "" }) {
                if (!x.isEmpty()) {
                    list.add(x + y);
                }
            }
        }
    }
    return list;
}
Example 39
Project: common_utils-master  File: ClassHelperTest.java View source code
@org.junit.Test
public void testIsImplementsInterface() throws Exception {
    org.junit.Assert.assertTrue(ClassHelper.isImplementsInterface(ArrayList.class, Collection.class));
    org.junit.Assert.assertTrue(ClassHelper.isImplementsInterface(SubClass.class, TestInterface.class));
    org.junit.Assert.assertFalse(ClassHelper.isImplementsInterface(String.class, Collection.class));
}
Example 40
Project: cooper-master  File: TestConfigUtil.java View source code
public static List<String> getSelfPath() {
    List<String> self = new ArrayList<String>();
    String[] envpath = System.getProperty("java.class.path").split(";");
    for (String path : envpath) {
        if (path.endsWith("classes") || path.indexOf("cooper.jar") != -1 || (path.indexOf("cooper-") != -1 && path.endsWith(".jar"))) {
            self.add(path);
        }
    }
    return self;
}
Example 41
Project: cordova-plugin-video-editor-master  File: VideoFilter.java View source code
public static String format(ArrayList<VideoFilter> listFilters) {
    StringBuffer result = new StringBuffer();
    Iterator<VideoFilter> it = listFilters.iterator();
    VideoFilter vf;
    while (it.hasNext()) {
        vf = it.next();
        result.append(vf.getFilterString());
        if (it.hasNext())
            result.append(",");
    }
    return result.toString();
}
Example 42
Project: ctci-master  File: Question.java View source code
public static void main(String[] args) {
    String testString = "mississippi";
    String[] stringList = { "is", "sip", "hi", "sis" };
    SuffixTree tree = new SuffixTree(testString);
    for (String s : stringList) {
        ArrayList<Integer> list = tree.search(s);
        if (list != null) {
            System.out.println(s + ": " + list.toString());
        }
    }
}
Example 43
Project: Desktop-master  File: ADocearFileFilter.java View source code
public List<String> getStringList(String property) {
    List<String> result = new ArrayList<String>();
    if (property == null || property.length() <= 0)
        return result;
    property = property.trim();
    String[] list = property.split("\\|");
    for (String s : list) {
        if (s != null && s.length() > 0) {
            result.add(s);
        }
    }
    return result;
}
Example 44
Project: DistSysDesign-master  File: RabbitEyeDataSet.java View source code
@Override
public void setTargetColumns() {
    // assumed that data from file has been pre processed
    // TODO this should be
    // somewhere else,in the
    // super class.
    // Type != class Aargh! I want more
    // powerful type systems
    targetColumnNumbers = new ArrayList<Integer>();
    // using zero based indexing
    targetColumnNumbers.add(1);
}
Example 45
Project: EclipseCodeFormatter-master  File: MockAnnotationUtil.java View source code
public static List<Field> findFieldsThatAreMarkedForMocking(EasyMockTest clazz) {
    List<Field> results = new ArrayList<Field>();
    Class<?> current = clazz.getClass();
    while (current != Object.class) {
        Field[] fields = current.getDeclaredFields();
        for (Field f : fields) {
            if (f.isAnnotationPresent(Mocked.class)) {
                results.add(f);
            }
        }
        current = current.getSuperclass();
    }
    return results;
}
Example 46
Project: ecologylabFundamental-master  File: XmlTextInCollection.java View source code
/**
	 * @param args
	 */
public static void main(String[] args) {
    TextBlockState textBlock = new TextBlockState("If you can read me, things are working. :)");
    ArrayList<TextBlockState> textBlockCollection = new ArrayList<TextBlockState>();
    textBlockCollection.add(textBlock);
//		try
//		{
//			//System.out.println(textBlockCollection.translateToXML());
//		} catch (XMLTranslationException e)
//		{
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
}
Example 47
Project: elements-of-programming-interviews-master  File: EvenThreadTest.java View source code
@Test
public void test() throws Exception {
    List<Integer> result = new ArrayList<>();
    Thread t1 = new ImplementThreadSyncronization.OddThread(result);
    Thread t2 = new ImplementThreadSyncronization.EvenThread(result);
    t1.start();
    t2.start();
    t1.join();
    t2.join();
    assertEquals(StreamUtil.sequence(100), result);
}
Example 48
Project: evercam-discovery-java-master  File: OnvifDiscoveryTest.java View source code
@Test
public void testOnvifProbe() {
    ArrayList<DiscoveredCamera> cameraList = new OnvifDiscovery() {

        @Override
        public void onActiveOnvifDevice(DiscoveredCamera discoveredCamera) {
            System.out.println("ONVIF camera discovered: " + discoveredCamera.toString());
        }
    }.probe();
    assertEquals(2, cameraList.size());
}
Example 49
Project: fitnesse-master  File: TableTableIncFirstCol.java View source code
public List<List<String>> doTable(List<List<?>> table) {
    List<List<String>> ret = new ArrayList<>();
    for (List<?> line : table) {
        List<String> retLine = new ArrayList<>();
        ret.add(retLine);
        retLine.add("no change");
        retLine.add("pass:" + (Integer.parseInt(line.get(0).toString()) + 1));
    }
    return ret;
}
Example 50
Project: haox-master  File: KrbConfHelper.java View source code
public static List<EncryptionType> getEncryptionTypes(List<String> encTypeNames) {
    List<EncryptionType> results = new ArrayList<EncryptionType>(encTypeNames.size());
    EncryptionType etype;
    for (String etypeName : encTypeNames) {
        etype = EncryptionType.fromName(etypeName);
        if (etype != EncryptionType.NONE) {
            results.add(etype);
        }
    }
    return results;
}
Example 51
Project: heuristics-and-optimization-master  File: RabbitEyeDataSet.java View source code
@Override
public void setTargetColumns() {
    // assumed that data from file has been pre processed
    // TODO this should be
    // somewhere else,in the
    // super class.
    // Type != class Aargh! I want more
    // powerful type systems
    targetColumnNumbers = new ArrayList<Integer>();
    // using zero based indexing
    targetColumnNumbers.add(1);
}
Example 52
Project: HotswapAgent-master  File: ViewConfigResolverUtils.java View source code
public static List findViewConfigRootClasses(ViewConfigNode configNode) {
    List result = new ArrayList<>();
    if (configNode != null) {
        if (configNode.getSource() != null) {
            result.add(configNode.getSource());
        } else {
            for (ViewConfigNode childNode : configNode.getChildren()) {
                if (childNode.getSource() != null) {
                    result.add(childNode.getSource());
                }
            }
        }
    }
    return result;
}
Example 53
Project: intellij-community-master  File: chainedFluentIterable_after.java View source code
void c() {
    ArrayList<String> strings = new ArrayList<String>();
    Stream<String> it = strings.stream();
    List<Boolean> booleans = it.map(String::isEmpty).collect(Collectors.toList());
    boolean empty = !it.map( s -> s.trim()).map( input -> input.toCharArray()).skip(777).filter( input -> input.length != 10).findAny().isPresent();
}
Example 54
Project: interview-master  File: StringEncoderDecoderTest.java View source code
@Test
public void testDifferentCases() {
    StringEncoderDecoder stringEncoderDecoder = new StringEncoderDecoder();
    List<String> input = new ArrayList<>();
    input.add("Tushar");
    input.add("Roy");
    input.add("");
    String encoded = stringEncoderDecoder.encode(input);
    List<String> result = stringEncoderDecoder.decode(encoded);
    TestUtil<String> testUtil = new TestUtil();
    testUtil.compareList(input, result);
}
Example 55
Project: java2word-master  File: EmployeeManager.java View source code
public static List<Employee> getResultList() {
    List<Employee> lst = new ArrayList<Employee>();
    lst.add(new Employee("Leonardo Correa", "40,000.00"));
    lst.add(new Employee("Romario da Silva", "500,000.00"));
    lst.add(new Employee("Ronaldinho", "850,000.00"));
    lst.add(new Employee("Kaka Ricardo de Oliveira", "1.240,000.00"));
    return lst;
}
Example 56
Project: javascript-algorithm-practice-master  File: RabbitEyeDataSet.java View source code
@Override
public void setTargetColumns() {
    // assumed that data from file has been pre processed
    // TODO this should be
    // somewhere else,in the
    // super class.
    // Type != class Aargh! I want more
    // powerful type systems
    targetColumnNumbers = new ArrayList<Integer>();
    // using zero based indexing
    targetColumnNumbers.add(1);
}
Example 57
Project: jayhorn-master  File: ControlStructures.java View source code
protected List<Integer> get(int i) {
    result = new ArrayList<Integer>();
    switch(i) {
        case 1:
            result.add(1);
            break;
        case 2:
            result.add(2);
        case 3:
            result.add(3);
            break;
        default:
            result.add(null);
    }
    switch(i) {
        case 1:
            result.add(1);
        case 10:
            result.add(10);
        case 100:
            result.add(100);
        case 1000:
            result.add(1000);
        default:
            result.add(null);
    }
    return result;
}
Example 58
Project: jeboorker-master  File: IteratorListTest.java View source code
public void testCursor() {
    ArrayList<String> first = new ArrayList<>();
    first.add("1");
    first.add("2");
    first.add("3");
    first.add("4");
    IteratorList<String> t = new IteratorList<>(first.iterator(), first.size());
    System.out.println(t.get(1));
    System.out.println(t.get(3));
    System.out.println(t.get(0));
}
Example 59
Project: jphp-master  File: ConstantsContainer.java View source code
public Collection<CompileConstant> getConstants() {
    List<CompileConstant> result = new ArrayList<CompileConstant>();
    for (Field field : getClass().getDeclaredFields()) {
        field.setAccessible(true);
        try {
            result.add(new CompileConstant(field.getName(), field.get(this)));
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
    return result;
}
Example 60
Project: jzgs-master  File: RadarDataSet.java View source code
@Override
public DataSet<Entry> copy() {
    ArrayList<Entry> yVals = new ArrayList<Entry>();
    for (int i = 0; i < mYVals.size(); i++) {
        yVals.add(mYVals.get(i).copy());
    }
    RadarDataSet copied = new RadarDataSet(yVals, getLabel());
    copied.mColors = mColors;
    copied.mHighLightColor = mHighLightColor;
    return copied;
}
Example 61
Project: kotlin-master  File: AssignMappedKotlinType.java View source code
void test() {
    int i1 = AssignMappedKotlinTypeKt.getInt();
    Integer i2 = AssignMappedKotlinTypeKt.getInt();
    Number number = AssignMappedKotlinTypeKt.getNumber();
    String str = AssignMappedKotlinTypeKt.getString();
    Collection<Integer> intCollection = AssignMappedKotlinTypeKt.getList();
    List<Integer> intList = AssignMappedKotlinTypeKt.getList();
    Collection<Integer> intMutableCollection = AssignMappedKotlinTypeKt.getMutableList();
    List<Integer> intMutableList = AssignMappedKotlinTypeKt.getMutableList();
    Collection<String> stringsCollection = AssignMappedKotlinTypeKt.getArrayList();
    ArrayList<String> arrayListCollection = AssignMappedKotlinTypeKt.getArrayList();
}
Example 62
Project: kunagi-master  File: SystemConfigDao.java View source code
public SystemConfig getSystemConfig() {
    List<SystemConfig> all = new ArrayList<SystemConfig>(getEntities());
    if (all.isEmpty()) {
        SystemConfig config = newEntityInstance();
        saveEntity(config);
        return config;
    }
    while (all.size() > 1) {
        SystemConfig config = all.get(0);
        deleteEntity(config);
        all.remove(config);
    }
    return all.get(0);
}
Example 63
Project: Latipics-master  File: Folder.java View source code
public ArrayList<File> getListOfFiles(File folder) {
    listOfFiles = new ArrayList<File>();
    if (folder.isDirectory()) {
        String[] children = folder.list();
        for (int i = 0; i < children.length; i++) {
            File newFile = new File(folder, children[i]);
            listOfFiles.add(newFile);
        }
        return listOfFiles;
    }
    return null;
}
Example 64
Project: learnrxjava-master  File: ScanVsReduceExample.java View source code
public static void main(String... args) {
    Observable.range(0, 10).reduce(new ArrayList<>(), ( list,  i) -> {
        list.add(i);
        return list;
    }).forEach(System.out::println);
    System.out.println("... vs ...");
    Observable.range(0, 10).scan(new ArrayList<>(), ( list,  i) -> {
        list.add(i);
        return list;
    }).forEach(System.out::println);
}
Example 65
Project: lemon-master  File: PartyEntityConverter.java View source code
public List<PartyEntityDTO> createPartyEntityDtos(List<PartyEntity> partyEntities) {
    List<PartyEntityDTO> partyEntityDtos = new ArrayList<PartyEntityDTO>();
    for (PartyEntity partyEntity : partyEntities) {
        PartyEntityDTO partyEntityDto = new PartyEntityDTO();
        partyEntityDto.setId(partyEntity.getId());
        partyEntityDto.setType(partyEntity.getPartyType().getName());
        partyEntityDto.setName(partyEntity.getName());
        partyEntityDtos.add(partyEntityDto);
    }
    return partyEntityDtos;
}
Example 66
Project: monitoring-master  File: InvalidStackMapFrame.java View source code
public void bytecodeVerifyError() {
    // javassist bug : invalid stack map frame
    List<Integer> test = new ArrayList<Integer>();
    String[] newLine = new String[10];
    for (Integer idx : test) {
        String address = newLine[1];
        int tabPos = -1;
        if (tabPos != -1) {
            address = address.substring(tabPos + 1);
        }
        newLine[4] = address;
    }
}
Example 67
Project: mule-camunda-24-master  File: BestellungFactory.java View source code
public Bestellung createBestellungMitZweiPositionen() {
    Bestellung b = new Bestellung();
    Adresse a = new AdresseFactory().createAdresse();
    b.setAdresse(a);
    b.setBemerkung("Keine schlaue Bemerkung");
    List<Position> ps = new ArrayList<>();
    PositionFactory pf = new PositionFactory();
    ps.add(pf.createHexPosition());
    ps.add(pf.createUnmoegliches());
    b.setPositionen(ps);
    return b;
}
Example 68
Project: MyGoogleImageSearch-master  File: EndlessAdapterFragment.java View source code
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setRetainInstance(true);
    if (adapter == null) {
        ArrayList<Integer> items = new ArrayList<Integer>();
        for (int i = 0; i < 25; i++) {
            items.add(i);
        }
        adapter = new DemoAdapter(getActivity(), items);
    } else {
        adapter.startProgressAnimation();
    }
    setListAdapter(adapter);
}
Example 69
Project: N-genes-2-master  File: MutatorTest.java View source code
@Test
public void testMutate() {
    Individual<Integer, ? extends Individual<Integer, ?>> individual = mock(Individual.class);
    when(individual.chromosome()).thenReturn(new ArrayList(0));
    ChromosomeMutator<Integer> chromMutator = mock(ChromosomeMutator.class);
    Mutator mutator = new Mutator(chromMutator);
    mutator.mutate(individual);
    verify(individual).makeSibling(new ArrayList(0));
}
Example 70
Project: Notification-Analyser-master  File: RadarDataSet.java View source code
@Override
public DataSet<Entry> copy() {
    ArrayList<Entry> yVals = new ArrayList<Entry>();
    for (int i = 0; i < mYVals.size(); i++) {
        yVals.add(mYVals.get(i).copy());
    }
    RadarDataSet copied = new RadarDataSet(yVals, getLabel());
    copied.mColors = mColors;
    copied.mHighLightColor = mHighLightColor;
    return copied;
}
Example 71
Project: oreva-master  File: ParameterizedTestHelper.java View source code
public static List<Object[]> addVariants(List<Object[]> parametersList, Object... variants) {
    List<Object[]> newParametersList = new ArrayList<Object[]>();
    for (Object[] parameters : parametersList) {
        int newParametersLength = parameters.length + 1;
        for (Object variant : variants) {
            Object[] newParameters = Arrays.copyOf(parameters, newParametersLength);
            newParameters[newParametersLength - 1] = variant;
            newParametersList.add(newParameters);
        }
    }
    return newParametersList;
}
Example 72
Project: packtpub-xtext-book-examples-master  File: ExtensionMethodsVariables.java View source code
public Object m() {
    Object _xblockexpression = null;
    {
        @Extension final MyListExtensions e = new MyListExtensions();
        final ArrayList<String> list = new ArrayList<String>();
        e.aListMethod(list);
        _xblockexpression = e.anotherListMethod(list);
    }
    return _xblockexpression;
}
Example 73
Project: phd_code-master  File: Test.java View source code
public static void main(String[] args) {
    int i = 125;
    int v_tt = 0;
    ArrayList<Integer> temp = new ArrayList<Integer>();
    while (true) {
        v_tt = v_tt + 1;
        int q = i % 10;
        temp.add(q);
        i = (int) (i / 10);
        System.out.println("q = " + q);
        System.out.println("i = " + i);
        if (i == 0)
            break;
    //if (v_tt>3) break;
    }
}
Example 74
Project: pinpoint-master  File: InvalidStackMapFrame.java View source code
public void bytecodeVerifyError() {
    // javassist bug : invalid stack map frame
    List<Integer> test = new ArrayList<Integer>();
    String[] newLine = new String[10];
    for (Integer idx : test) {
        String address = newLine[1];
        int tabPos = -1;
        if (tabPos != -1) {
            address = address.substring(tabPos + 1);
        }
        newLine[4] = address;
    }
}
Example 75
Project: playpal-master  File: AnnotationPluginHelper.java View source code
public static List<Class> getJavaClasses(final List<ApplicationClasses.ApplicationClass> classes) {
    List<Class> returnValues = new ArrayList<Class>();
    for (ApplicationClasses.ApplicationClass cls : classes) {
        if (cls.javaClass != null && !cls.javaClass.isInterface() && !cls.javaClass.isAnnotation()) {
            returnValues.add(cls.javaClass);
        }
    }
    return returnValues;
}
Example 76
Project: porextenso-master  File: BroaderVariety.java View source code
public static void main(String[] args) {
    String[] valores = new String[] { "5", "0.10", "1232.50", "130000000000" };
    List<BigDecimal> quantias = new ArrayList<BigDecimal>();
    for (String v : valores) {
        quantias.add(new BigDecimal(v));
    }
    CurrencyWriter cw = CurrencyWriter.getInstance();
    for (BigDecimal quantia : quantias) {
        System.out.println(cw.write(quantia));
    }
}
Example 77
Project: ServletStudyDemo-master  File: Demo1.java View source code
/**
	 * @param args
	 */
public static void main(String[] args) {
    List list = new ArrayList();
    list.add("abc");
    //Integer i=(Integer) list.get(0);//Exception in thread "main" java.lang.ClassCastException: java.lang.String
    List<String> list2 = new ArrayList<String>();
    list2.add("mushroom");
    String str = list2.get(0);
    //mushroom
    System.out.println(str);
}
Example 78
Project: SOCIETIES-Platform-master  File: TestCSE.java View source code
/**
	 * @param args
	 */
@Test
public void testOccupation() {
    System.out.println("test Occupation");
    ContextSimilarityEvaluator cse = new ContextSimilarityEvaluator();
    //,"jtest2"};
    String[] ids = { "jtest1" };
    ArrayList<String> attrib = new ArrayList<String>();
    attrib.add("occupation");
//evaluationResults ie = (evaluationResults) cse.evaluateSimilarity(ids, attrib);
}
Example 79
Project: ssh-spool-source-master  File: SshClientDriver.java View source code
public static void main(String[] args) {
    SshClientJ sc = new SshClientJ("localhost", "user", "pass");
    ArrayList<String> files = sc.getFilesInPath("/remote-path/");
    System.out.println("Size of files array: " + files.size());
    for (String file : files) {
        byte[] b = sc.getContents(file);
        System.out.println("filename: " + file + ", size: " + b.length);
    }
}
Example 80
Project: stubgen-master  File: ListInstantiator.java View source code
@SuppressWarnings("unchecked")
@Override
public <T> T newInstance(Class<?> T) throws MockGenException {
    ArrayList<T> list = new ArrayList<T>();
    for (int i = 0; i < MockObjectGenerator.DEFAULT_ARRAY_LENGTH; i++) {
        MockObjectGenerator localGenerator = new MockObjectGenerator();
        T element = localGenerator.generate(T, 1);
        list.add(element);
    }
    return (T) list;
}
Example 81
Project: swagger-core-master  File: ReaderExtensionsTest.java View source code
@Test
public void getExtensionsTest() {
    final List<ReaderExtension> extensions = ReaderExtensions.getExtensions();
    Assert.assertEquals(extensions.size(), 3);
    final List<Integer> originalPriority = new ArrayList<Integer>();
    for (ReaderExtension extension : extensions) {
        originalPriority.add(extension.getPriority());
    }
    Assert.assertEquals(originalPriority, Arrays.asList(0, 10, 20));
}
Example 82
Project: tddl-master  File: PermutationGeneratorTest.java View source code
@Test
public void testNext() {
    List<Integer> elements = new ArrayList<Integer>();
    elements.add(1);
    elements.add(2);
    elements.add(3);
    PermutationGenerator instance = new PermutationGenerator(elements);
    while (instance.hasNext()) {
        List result = instance.next();
        System.out.println(result);
    }
}
Example 83
Project: twitter-like-example-master  File: ResourceUtils.java View source code
public static <T> Iterable<T> getContents(Resource<? extends T>... resources) {
    List<T> result = new ArrayList<T>();
    if (resources != null) {
        for (Resource<? extends T> current : resources) {
            if (current != null && current.getContent() != null) {
                result.add(current.getContent());
            }
        }
    }
    return result;
}
Example 84
Project: uConomy-master  File: ItemUtils.java View source code
public static String toFriendlyName(Material material) {
    String materialName = material.name().toLowerCase();
    if (!materialName.contains("_")) {
        return StringUtils.capitalize(materialName);
    }
    List<String> words = new ArrayList<String>();
    for (String word : materialName.split("_")) {
        StringUtils.capitalize(word);
        words.add(word);
    }
    return StringUtils.join(words, " ");
}
Example 85
Project: umlet-master  File: Lines.java View source code
public static List<PointDouble> toPoints(Line... lines) {
    List<PointDouble> points = new ArrayList<PointDouble>();
    for (Line line : lines) {
        for (PointDouble p : line.toPoints()) {
            if (points.isEmpty() || !points.get(points.size() - 1).equals(p)) {
                points.add(p);
            }
        }
    }
    return points;
}
Example 86
Project: unutopia-android-master  File: PruebaDatos.java View source code
public ArrayList<ArticleItem> PruebaDatos() {
    ArrayList<ArticleItem> listItems = new ArrayList<ArticleItem>();
    listItems.add(new ArticleItem(1, "Titulo 1", "Autor 1", "26/06/2012"));
    listItems.add(new ArticleItem(2, "Titulo 2", "Autor 2", "26/06/2012"));
    listItems.add(new ArticleItem(3, "Titulo 3", "Autor 2", "26/06/2012"));
    return listItems;
}
Example 87
Project: valkyrie-master  File: JMXMbeanServerFactory.java View source code
public static MBeanServer getMBeanServer() {
    MBeanServer mbserver = null;
    ArrayList<MBeanServer> mbservers = MBeanServerFactory.findMBeanServer(null);
    if (mbservers.size() > 0) {
        mbserver = (MBeanServer) mbservers.get(0);
    }
    if (mbserver != null) {
    } else {
        mbserver = MBeanServerFactory.createMBeanServer();
    }
    return mbserver;
}
Example 88
Project: vertexium-master  File: ObjectUtilsTest.java View source code
@Test
public void testCompare() {
    assertEquals(0, ObjectUtils.compare(null, null));
    assertEquals(1, ObjectUtils.compare(null, 1));
    assertEquals(-1, ObjectUtils.compare(1, null));
    ArrayList<Integer> list = Lists.newArrayList(1, null);
    list.sort(ObjectUtils::compare);
    assertEquals(1, (int) list.get(0));
    assertEquals(null, list.get(1));
}
Example 89
Project: VUE-master  File: CabList.java View source code
public static void main(String args[]) {
    ArrayList names = CabUtil.parseCommandLine(args);
    if (names.size() < 1)
        names.add(".");
    Iterator i = names.iterator();
    while (i.hasNext()) {
        String cabName = (String) i.next();
        Cabinet cabinet = CabUtil.getCabinet(cabName);
        CabUtil.printCabinet(cabinet);
    }
}
Example 90
Project: wang-s-Code-master  File: ContactService.java View source code
/**
	 * »ñÈ¡ÁªÏµÈË
	 * @return
	 */
public List<Contact> getContacts() {
    List<Contact> contacts = new ArrayList<Contact>();
    contacts.add(new Contact(12, "ÕÅÃ÷", "13766666666", 13003));
    contacts.add(new Contact(23, "СС", "130066006", 122003));
    contacts.add(new Contact(98, "ÀîС¿¬", "186768768", 10988787));
    contacts.add(new Contact(76, "ÕÔµÃ", "1565622566", 1666));
    return contacts;
}
Example 91
Project: wayback-machine-master  File: JSONPathSpecFactory.java View source code
public static JSONPathSpec get(String spec) {
    if (spec.contains("|")) {
        // compound OR:
        String parts[] = spec.split("\\|");
        ArrayList<JSONPathSpec> subs = new ArrayList<JSONPathSpec>(parts.length);
        for (String part : parts) {
            subs.add(new SimpleJSONPathSpec(part));
        }
        return new CompoundORJSONPathSpec(subs);
    } else {
        // assume "simple":
        return new SimpleJSONPathSpec(spec);
    }
}
Example 92
Project: webarchive-commons-master  File: JSONPathSpecFactory.java View source code
public static JSONPathSpec get(String spec) {
    if (spec.contains("|")) {
        // compound OR:
        String parts[] = spec.split("\\|");
        ArrayList<JSONPathSpec> subs = new ArrayList<JSONPathSpec>(parts.length);
        for (String part : parts) {
            subs.add(new SimpleJSONPathSpec(part));
        }
        return new CompoundORJSONPathSpec(subs);
    } else {
        // assume "simple":
        return new SimpleJSONPathSpec(spec);
    }
}
Example 93
Project: wonder-master  File: FlattenedIteratorTest.java View source code
public void test1_discoveredNPETest() {
    // it used to fail when internal iterator was not present, due to NullPointerException
    List<Iterator<Object>> iterators = new ArrayList<Iterator<Object>>();
    FlattenedIterator<Object> it = new FlattenedIterator<>(iterators.iterator());
    while (it.hasNext()) {
        it.next();
    }
}
Example 94
Project: wonderdb-master  File: TestDBufferAllocation.java View source code
public static void main(String[] args) {
    //		int i = 0;
    List<ByteBuffer> list = new ArrayList<ByteBuffer>();
    try {
        while (true) {
            list.add(ByteBuffer.allocateDirect(2048));
        //				i++;
        }
    } catch (Throwable t) {
        System.out.println("allocated: " + list.size());
        t.printStackTrace();
    }
}
Example 95
Project: Work_book-master  File: ShuffleTest.java View source code
public static void main(String[] args) {
    List<Integer> numbers = new ArrayList<Integer>();
    for (int i = 1; i <= 49; i++) {
        numbers.add(i);
    }
    Collections.shuffle(numbers);
    List<Integer> winningCombination = numbers.subList(0, 6);
    Collections.sort(winningCombination);
    System.out.println(winningCombination);
}
Example 96
Project: yoga-master  File: PropertyUtil.java View source code
public static List<PropertyDescriptor> getReadableProperties(Class<?> instanceType) {
    List<PropertyDescriptor> result = new ArrayList<PropertyDescriptor>();
    for (PropertyDescriptor descriptor : PropertyUtils.getPropertyDescriptors(instanceType)) {
        if (descriptor.getReadMethod() != null && !descriptor.getName().equals("class")) {
            result.add(descriptor);
        }
    }
    return result;
}
Example 97
Project: zava-master  File: ScanVsReduceExample.java View source code
public static void main(String... args) {
    Observable.range(0, 10).reduce(new ArrayList<>(), ( list,  i) -> {
        list.add(i);
        return list;
    }).forEach(System.out::println);
    System.out.println("... vs ...");
    Observable.range(0, 10).scan(new ArrayList<>(), ( list,  i) -> {
        list.add(i);
        return list;
    }).forEach(System.out::println);
}
Example 98
Project: datanucleus-core-master  File: ClassUtilsTest.java View source code
/**
     * Test for the superclasses of a class.
     */
public void testGetSuperclasses() {
    Collection<Class<?>> superclasses = ClassUtils.getSuperclasses(java.util.ArrayList.class);
    assertTrue("java.util.ArrayList should have had 3 superclasses, but had " + superclasses.size(), superclasses.size() == 3);
    assertTrue("java.util.ArrayList should have had a superclass of AbstractList, but didn't !", superclasses.contains(AbstractList.class));
    assertTrue("java.util.ArrayList should have had a superclass of AbstractCollection, but didn't !", superclasses.contains(AbstractCollection.class));
    assertTrue("java.util.ArrayList should have had a superclass of Object, but didn't !", superclasses.contains(Object.class));
}
Example 99
Project: JCommons-master  File: XmlUtil.java View source code
public static Map Dom2Map(Element e) {
    Map map = new HashMap();
    List list = e.elements();
    if (list.size() > 0) {
        for (int i = 0; i < list.size(); i++) {
            Element iter = (Element) list.get(i);
            List mapList = new ArrayList();
            if (iter.elements().size() > 0) {
                Map m = Dom2Map(iter);
                if (map.get(iter.getName()) != null) {
                    Object obj = map.get(iter.getName());
                    if (!obj.getClass().getName().equals("java.util.ArrayList")) {
                        mapList = new ArrayList();
                        mapList.add(obj);
                        mapList.add(m);
                    }
                    if (obj.getClass().getName().equals("java.util.ArrayList")) {
                        mapList = (List) obj;
                        mapList.add(m);
                    }
                    map.put(iter.getName(), mapList);
                } else
                    map.put(iter.getName(), m);
            } else {
                if (map.get(iter.getName()) != null) {
                    Object obj = map.get(iter.getName());
                    if (!obj.getClass().getName().equals("java.util.ArrayList")) {
                        mapList = new ArrayList();
                        mapList.add(obj);
                        mapList.add(iter.getText());
                    }
                    if (obj.getClass().getName().equals("java.util.ArrayList")) {
                        mapList = (List) obj;
                        mapList.add(iter.getText());
                    }
                    map.put(iter.getName(), mapList);
                } else
                    map.put(iter.getName(), iter.getText());
            }
        }
    } else
        map.put(e.getName(), e.getText());
    return map;
}
Example 100
Project: roaster-master  File: JavaSourceCompatibilityTest.java View source code
@Test
public void testSupportsGenericsSourceFromAddedConstructor() throws Exception {
    JavaClassSource source = Roaster.parse(JavaClassSource.class, "public class Test{}");
    // Add a new method to get JDT to recognize the new ASTs
    source.addMethod().setConstructor(true).setBody("java.util.List<String> s = new java.util.ArrayList<String>(); for (String item : s){}");
    // Forces a rewrite to happen via AbstractJavaSource
    source.toString();
    Assert.assertFalse(source.hasSyntaxErrors());
}
Example 101
Project: dbfit-master  File: PropertiesTestsSetUp.java View source code
private static List<String> prepareGeneralSettings() {
    List<String> lines = new java.util.ArrayList<String>();
    lines.add("# Some comments");
    lines.add("service=mydemoservice");
    lines.add("username=mydemouser");
    lines.add("database=mydemodb");
    lines.add("connection-string=myconnection");
    // empty line
    lines.add("");
    // empty line
    lines.add(" ");
    lines.add(" # indented comment");
    lines.add("#=another commented line");
    return lines;
}