Ejemplo n.º 1
0
  @SuppressWarnings("unchecked")
  @Pure
  @ShouldBePure
  public static <K> void checkSeq(ISeq<K> in, int expectedLength, K expectedFirst) {
    Pure4J.immutable(in, expectedFirst);

    log("seq: " + in.toString());

    log(in.next().toString());

    assertEquals(expectedLength, in.size());
    assertEquals(expectedFirst, in.first());
    if (in instanceof List) {
      assertEquals(0, ((List<K>) in).indexOf(expectedFirst));
    }

    assertEquals(0, in.lastIndexOf(expectedFirst));
    assertEquals(-1, in.lastIndexOf("sdkfhsk"));
    assertEquals(0, in.indexOf(expectedFirst));
    assertEquals(-1, in.indexOf("sjfhgds"));
    assertEquals(-1, in.indexOf(null));
    assertEquals(-1, in.lastIndexOf(null));
  }
 @Override
 @ShouldBePure
 public String toString() {
   return Pure4J.toString(this, in);
 }
 @ShouldBePure
 @Override
 public int hashCode() {
   return Pure4J.hashCode(in);
 }