Examples of lastKey()


Examples of java.util.SortedMap.lastKey()

        SortedMap map = makeTestSortedMap(oneFactory);
        map.put("A""a");
        map.get("B"); // Entry with value "One" created
        map.put("C", "c");
        assertEquals("First key should be A", map.firstKey(), "A");
        assertEquals("Last key should be C", map.lastKey(), "C");
        assertEquals("First key in tail map should be B",
            map.tailMap("B").firstKey(), "B");
        assertEquals("Last key in head map should be B",
            map.headMap("C").lastKey(), "B");
        assertEquals("Last key in submap should be B",
View Full Code Here

Examples of java.util.SortedMap.lastKey()

        SortedMap sm = (SortedMap) maps[0];
        SortedMap hm = sm.headMap(key);
        if (hm.isEmpty()) {
            return null;
        }
        return hm.lastKey();
    }

    //-----------------------------------------------------------------------
    /**
     * Obtains an ordered map iterator.
View Full Code Here

Examples of java.util.SortedMap.lastKey()

        if( tmp == null )
        {   // Find the closest parent position.
            SortedMap headMap = namespacePerms.headMap(key);
            try
            {
                PermissionName lastKey = (PermissionName) headMap.lastKey();
                if( lastKey.isParent(key) == true )
                    tmp = (ArrayList) namespacePerms.get(lastKey);
                else
                {
                    PermissionName[] keys = {};
View Full Code Here

Examples of java.util.SortedMap.lastKey()

    // adjust line and column counting
    if (isFlagSet(Flags.F_COUNT_LINES)) {
      SortedMap map         = _position2LineMap.headMap(new Integer(position + 1));
     
      if (map != null &&  ! map.isEmpty()) {
        Integer lastLineStart = (Integer)map.lastKey();
       
        _lineNumber   = ((Integer)map.get(lastLineStart)).intValue();
        _columnNumber = position - lastLineStart.intValue();
      } else {
        _lineNumber   = 0;
View Full Code Here

Examples of java.util.SortedMap.lastKey()

        SortedMap skipMap = getSkipMap();
        synchronized (skipMap) {
            SortedMap head = skipMap.headMap(new Long(time));
            if (!head.isEmpty()) {
                eventBundleBuffer.clear();
                lastRevision = (Long) head.get(head.lastKey());
            }
        }

        try {
            while (hasNext()) {
View Full Code Here

Examples of java.util.SortedMap.lastKey()

     */
    private void updateIndex(TimeIndex idx) {
        SortedMap headMap = assocCache.headMap(idx);
        idx.time--;
        if (!headMap.isEmpty()) {
            TimeIndex lastIdx = (TimeIndex) headMap.lastKey();
            if (lastIdx.time == idx.time)
                idx.sequence = lastIdx.sequence + 1;
        }
    }
   
View Full Code Here

Examples of java.util.SortedMap.lastKey()

        SortedMap skipMap = getSkipMap();
        synchronized (skipMap) {
            SortedMap head = skipMap.headMap(new Long(time));
            if (!head.isEmpty()) {
                eventBundleBuffer.clear();
                lastRevision = (Long) head.get(head.lastKey());
            }
        }

        try {
            while (hasNext()) {
View Full Code Here

Examples of java.util.SortedMap.lastKey()

        SortedMap map = makeTestSortedMap(oneFactory);
        map.put("A""a");
        map.get("B"); // Entry with value "One" created
        map.put("C", "c");
        assertEquals("First key should be A", map.firstKey(), "A");
        assertEquals("Last key should be C", map.lastKey(), "C");
        assertEquals("First key in tail map should be B",
            map.tailMap("B").firstKey(), "B");
        assertEquals("Last key in head map should be B",
            map.headMap("C").lastKey(), "B");
        assertEquals("Last key in submap should be B",
View Full Code Here

Examples of java.util.SortedMap.lastKey()

            fail("Null value should raise IllegalArgument");
        } catch (IllegalArgumentException e) {
            // expected
        }
        assertEquals("First key should be A", map.firstKey(), "A");
        assertEquals("Last key should be C", map.lastKey(), "C");
        assertEquals("First key in tail map should be B",
            map.tailMap("B").firstKey(), "B");
        assertEquals("Last key in head map should be B",
            map.headMap("C").lastKey(), "B");
        assertEquals("Last key in submap should be B",
View Full Code Here

Examples of java.util.SortedMap.lastKey()

        SortedMap sm = (SortedMap) makeFullMap();
        Object obj = null;
        for (Iterator it = sm.keySet().iterator(); it.hasNext();) {
            obj = (Object) it.next();
        }
        assertSame(obj, sm.lastKey());
    }
   
    //-----------------------------------------------------------------------   
    public BulkTest bulkTestHeadMap() {
        return new TestHeadMap(this);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.