Search in sources :

Example 26 with CharSeq

use of javaslang.collection.CharSeq in project javaslang by javaslang.

the class CharSeqTest method shouldInsertIntoSeq.

@Test
public void shouldInsertIntoSeq() {
    final CharSeq actual = of('1', '2', '3').insert(2, '4');
    final CharSeq expected = of('1', '2', '4', '3');
    assertThat(actual).isEqualTo(expected);
}
Also used : CharSeq(javaslang.collection.CharSeq) Test(org.junit.Test)

Example 27 with CharSeq

use of javaslang.collection.CharSeq in project javaslang by javaslang.

the class CharSeqTest method shouldLeftPadNonEmptyZeroLen.

@Test
public void shouldLeftPadNonEmptyZeroLen() {
    final CharSeq seq = of('a');
    assertThat(seq.leftPadTo(0, 'b')).isSameAs(seq);
}
Also used : CharSeq(javaslang.collection.CharSeq) Test(org.junit.Test)

Example 28 with CharSeq

use of javaslang.collection.CharSeq in project javaslang by javaslang.

the class CharSeqTest method shouldPrependAllNilToNil.

@Test
public void shouldPrependAllNilToNil() {
    final CharSeq actual = empty().prependAll(empty());
    final CharSeq expected = empty();
    assertThat(actual).isEqualTo(expected);
}
Also used : CharSeq(javaslang.collection.CharSeq) Test(org.junit.Test)

Example 29 with CharSeq

use of javaslang.collection.CharSeq in project javaslang by javaslang.

the class CharSeqTest method shouldReturnNilWhenIndicesBothAreUpperBound.

@Test
public void shouldReturnNilWhenIndicesBothAreUpperBound() {
    final CharSeq actual = of('1', '2', '3').subSequence(3, 3);
    assertThat(actual).isSameAs(empty());
}
Also used : CharSeq(javaslang.collection.CharSeq) Test(org.junit.Test)

Example 30 with CharSeq

use of javaslang.collection.CharSeq in project javaslang by javaslang.

the class Euler36Test method isDoubleBasePalindrome.

private static boolean isDoubleBasePalindrome(int x) {
    final CharSeq seq = CharSeq.of(Integer.toString(x));
    final CharSeq rev = CharSeq.of(Integer.toBinaryString(x));
    return isPalindrome(seq) && isPalindrome(rev);
}
Also used : CharSeq(javaslang.collection.CharSeq)

Aggregations

CharSeq (javaslang.collection.CharSeq)69 Test (org.junit.Test)68 java.util (java.util)4 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 Arrays.asList (java.util.Arrays.asList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 Serializables.deserialize (javaslang.Serializables.deserialize)1 Serializables.serialize (javaslang.Serializables.serialize)1 Tuple (javaslang.Tuple)1 Tuple2 (javaslang.Tuple2)1 List (javaslang.collection.List)1 Seq (javaslang.collection.Seq)1 Option (javaslang.control.Option)1 org.assertj.core.api (org.assertj.core.api)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1