val() public method

Get the value in a key/value pair.
public val ( ) : object
return object
Ejemplo n.º 1
0
        public void CtorCreatesEntryWithProperKeyVal()
        {
            MapEntry me = new MapEntry(1, "abc");

            Expect(me.key(), EqualTo(1));
            Expect(me.val(), EqualTo("abc"));
        }
Ejemplo n.º 2
0
        public void ConsWorks()
        {
            MapEntry me = new MapEntry(1, "abc");
            IPersistentVector v1 = me.cons(2);

            Expect(me.count(), EqualTo(2));
            Expect(me.key(), EqualTo(1));
            Expect(me.val(), EqualTo("abc"));

            Expect(v1.count(), EqualTo(3));
            Expect(v1.nth(0), EqualTo(1));
            Expect(v1.nth(1), EqualTo("abc"));
            Expect(v1.nth(2), EqualTo(2));
        }
Ejemplo n.º 3
0
        public void AssocNInRangeModifies()
        {
            MapEntry me = new MapEntry(1, "abc");
            IPersistentVector v1 = me.assocN(0, 2);
            IPersistentVector v2 = me.assocN(1, "def");
            IPersistentVector v3 = me.assocN(2, "ghi");

            Expect(me.count(), EqualTo(2));
            Expect(me.key(), EqualTo(1));
            Expect(me.val(), EqualTo("abc"));

            Expect(v1.count(), EqualTo(2));
            Expect(v1.nth(0), EqualTo(2));
            Expect(v1.nth(1), EqualTo("abc"));

            Expect(v2.count(), EqualTo(2));
            Expect(v2.nth(0), EqualTo(1));
            Expect(v2.nth(1), EqualTo("def"));

            Expect(v3.count(), EqualTo(3));
            Expect(v3.nth(0), EqualTo(1));
            Expect(v3.nth(1), EqualTo("abc"));
            Expect(v3.nth(2), EqualTo("ghi"));
        }
Ejemplo n.º 4
0
        public void PeekReturnsVal()
        {
            MapEntry me = new MapEntry(1, "abc");

            Expect(me.peek(), EqualTo("abc"));
            Expect(me.count(), EqualTo(2));
            Expect(me.key(), EqualTo(1));
            Expect(me.val(), EqualTo("abc"));
        }
Ejemplo n.º 5
0
        public void ExplictIPersistentCollectionConsWorks()
        {
            MapEntry me = new MapEntry(1, "abc");
            IPersistentCollection c = (IPersistentCollection)me;
            ISeq s = c.cons(2).seq();

            Expect(me.count(), EqualTo(2));
            Expect(me.key(), EqualTo(1));
            Expect(me.val(), EqualTo("abc"));

            Expect(s.count(), EqualTo(3));
            Expect(s.first(), EqualTo(1));
            Expect(s.next().first(), EqualTo("abc"));
            Expect(s.next().next().first(), EqualTo(2));
            Expect(s.next().next().next(), Null);
        }