Package org.apache.commons.collections15.comparators

Examples of org.apache.commons.collections15.comparators.ReverseComparator


            assertTrue("NoSuchElementException must be thrown", e.getClass().equals((new NoSuchElementException()).getClass()));
        }
    }

    public void testReset() {
        ResettableListIterator it = (ResettableListIterator) makeObject();

        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());

        it.reset();

        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());

        it.reset();
        it.reset();

        assertEquals(true, it.hasNext());
    }
View Full Code Here


            }

            vv.setBackground(Color.WHITE);


            Transformer labelTransformer = new ChainedTransformer<String, String>(new Transformer[]{
                        new ToStringLabeller<Node>() {

                            public String transform(Node v) {
                                return v.getLabel();
                                //return ((primitives.graph.Node)(v.getVertex())).getLabel();
View Full Code Here

     * their natural ordering.
     */
    @SuppressWarnings("unchecked")
    public SortedSparseMultigraph()
    {
        this(new ComparableComparator(), new ComparableComparator());
    }
View Full Code Here

        } catch (BufferUnderflowException ex) {
        }
    }

    public void testBasicComparatorOps() {
        PriorityBuffer heap = new PriorityBuffer(new ReverseComparator(new ComparableComparator()));

        assertTrue("heap should be empty after create", heap.isEmpty());

        try {
            heap.get();
View Full Code Here

     * OrderedMap uses TreeMap as its known comparison.
     *
     * @return a map that is known to be valid
     */
    public Map makeConfirmedMap() {
        return new TreeMap(new NullComparator(ComparableComparator.getInstance()));
    }
View Full Code Here

     * The only confirmed collection we have that is ordered is the sorted one.
     * Thus, sort the keys.
     */
    public Object[] getSampleKeys() {
        List list = new ArrayList(Arrays.asList(super.getSampleKeys()));
        Collections.sort(list, new NullComparator(ComparableComparator.getInstance()));
        return list.toArray();
    }
View Full Code Here

        } catch (BufferUnderflowException ex) {
        }
    }

    public void testBasicComparatorOps() {
        PriorityBuffer heap = new PriorityBuffer(new ReverseComparator(new ComparableComparator()));

        assertTrue("heap should be empty after create", heap.isEmpty());

        try {
            heap.get();
View Full Code Here

    public TestDualTreeBidiMap2(String testName) {
        super(testName);
    }

    public BidiMap makeEmptyBidiMap() {
        return DualTreeBidiMap.createTwoWayBidiMap(new ReverseComparator(ComparableComparator.getInstance()));
    }
View Full Code Here

    public BidiMap makeEmptyBidiMap() {
        return DualTreeBidiMap.createTwoWayBidiMap(new ReverseComparator(ComparableComparator.getInstance()));
    }

    public Map makeConfirmedMap() {
        return new TreeMap(new ReverseComparator(ComparableComparator.getInstance()));
    }
View Full Code Here

    public void testSortOrder() throws Exception {
        SortedBidiMap sm = (SortedBidiMap) makeFullMap();

        // Sort by the comparator used in the makeEmptyBidiMap() method
        List newSortedKeys = Arrays.asList(getSampleKeys());
        Collections.sort(newSortedKeys, new ReverseComparator(ComparableComparator.getInstance()));
        newSortedKeys = Collections.unmodifiableList(newSortedKeys);

        Iterator mapIter = sm.keySet().iterator();
        Iterator expectedIter = newSortedKeys.iterator();
        while (expectedIter.hasNext()) {
View Full Code Here

TOP

Related Classes of org.apache.commons.collections15.comparators.ReverseComparator

Copyright © 2018 www.massapicom. 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.