Search in sources :

Example 16 with StringJoiner

use of java.util.StringJoiner in project jdk8u_jdk by JetBrains.

the class StringJoinerTest method addCharSequenceWithEmptyValue.

public void addCharSequenceWithEmptyValue() {
    StringJoiner sj = new StringJoiner(",").setEmptyValue(EMPTY);
    CharSequence cs_one = ONE;
    CharSequence cs_two = TWO;
    sj.add(cs_one);
    sj.add(cs_two);
    assertEquals(sj.toString(), ONE + "," + TWO);
    sj = new StringJoiner(DASH, "{", "}");
    sj.add(cs_one);
    sj.add(cs_two);
    assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
    sj = new StringJoiner(DASH, "{", "}");
    assertEquals(sj.toString(), "{}");
    sj = new StringJoiner("=", "{", "}").setEmptyValue("");
    assertEquals(sj.toString(), "");
    sj = new StringJoiner(DASH, "{", "}").setEmptyValue(EMPTY);
    assertEquals(sj.toString(), EMPTY);
    sj.add(cs_one);
    sj.add(cs_two);
    assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
}
Also used : StringJoiner(java.util.StringJoiner)

Example 17 with StringJoiner

use of java.util.StringJoiner in project jdk8u_jdk by JetBrains.

the class StringJoinerTest method noAddAndEmptyValue.

public void noAddAndEmptyValue() {
    StringJoiner sj = new StringJoiner(DASH, "", "").setEmptyValue(EMPTY);
    assertEquals(sj.toString(), EMPTY);
    sj = new StringJoiner(DASH, "<..", "");
    assertEquals(sj.toString(), "<..");
    sj = new StringJoiner(DASH, "<..", "");
    assertEquals(sj.toString(), "<..");
    sj = new StringJoiner(DASH, "", "==>");
    assertEquals(sj.toString(), "==>");
    sj = new StringJoiner(DASH, "{", "}");
    assertEquals(sj.toString(), "{}");
}
Also used : StringJoiner(java.util.StringJoiner)

Example 18 with StringJoiner

use of java.util.StringJoiner in project jdk8u_jdk by JetBrains.

the class StringJoinerTest method stringFromtoStringWithEmptyValue.

public void stringFromtoStringWithEmptyValue() {
    StringJoiner sj = new StringJoiner(" ", "", "");
    assertEquals(sj.toString(), "");
    sj = new StringJoiner(", ");
    assertEquals(sj.toString(), "");
    sj = new StringJoiner(",", "{", "}");
    assertEquals(sj.toString(), "{}");
    sj = new StringJoiner(",", "{", "}").setEmptyValue("");
    assertEquals(sj.toString(), "");
    sj = new StringJoiner(",");
    sj.add(ONE);
    assertEquals(sj.toString(), ONE);
    sj.add(TWO);
    assertEquals(sj.toString(), ONE + "," + TWO);
    sj = new StringJoiner(",", "{--", "--}");
    sj.add(ONE);
    assertEquals(sj.toString(), "{--" + ONE + "--}");
    sj.add(TWO);
    assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}");
}
Also used : StringJoiner(java.util.StringJoiner)

Example 19 with StringJoiner

use of java.util.StringJoiner in project jdk8u_jdk by JetBrains.

the class StringJoinerTest method addString.

public void addString() {
    StringJoiner sj = new StringJoiner(DASH);
    sj.add(ONE);
    assertEquals(sj.toString(), ONE);
    sj = new StringJoiner(DASH, "{", "}");
    sj.add(ONE);
    assertEquals(sj.toString(), "{" + ONE + "}");
    sj.add(TWO);
    assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
}
Also used : StringJoiner(java.util.StringJoiner)

Example 20 with StringJoiner

use of java.util.StringJoiner in project jdk8u_jdk by JetBrains.

the class StringJoinerTest method toStringWithCustomEmptyValue.

public void toStringWithCustomEmptyValue() {
    StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY);
    assertEquals(sj.toString(), EMPTY);
    sj.add("");
    assertEquals(sj.toString(), "<>");
    sj.add("");
    assertEquals(sj.toString(), "<->");
}
Also used : StringJoiner(java.util.StringJoiner)

Aggregations

StringJoiner (java.util.StringJoiner)94 ArrayList (java.util.ArrayList)20 List (java.util.List)10 HashSet (java.util.HashSet)6 Map (java.util.Map)6 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 Collectors (java.util.stream.Collectors)4 ClassName (com.squareup.javapoet.ClassName)3 FieldSpec (com.squareup.javapoet.FieldSpec)3 ParameterizedTypeName (com.squareup.javapoet.ParameterizedTypeName)3 TypeName (com.squareup.javapoet.TypeName)3 TypeSpec (com.squareup.javapoet.TypeSpec)3 Expression (com.sri.ai.expresso.api.Expression)3 Attribute (io.requery.meta.Attribute)3 Scanner (java.util.Scanner)3 RaptorColumnHandle (com.facebook.presto.raptor.RaptorColumnHandle)2 Range (com.facebook.presto.spi.predicate.Range)2 MaterializedResult (com.facebook.presto.testing.MaterializedResult)2 MaterializedRow (com.facebook.presto.testing.MaterializedRow)2