Code example for Ordering

Methods: sortedCopy

0
    public void testCustomOrderingWithMissingValue() { 
        order.addPartialOrdering(asList(1, 2, 4, 5));
        Assert.assertEquals(asList(1, 2, 4, 5), order.getCompletelyOrderedItems());
 
        Ordering<Integer> completeOrdering = order.getCompleteOrdering();
        Assert.assertEquals(asList(2, 4, 3), completeOrdering.sortedCopy(asList(4, 2, 3)));
    } 
 
    @Test
    public void testSortingCopy() { 
        order.addPartialOrdering(asList(1, 9));
        order.addPartialOrdering(asList(3));
        order.addPartialOrdering(asList(6));
        order.addPartialOrdering(asList(8));
        order.addPartialOrdering(asList(2));
        order.addPartialOrdering(asList(4));
        order.addPartialOrdering(asList(7));
        Assert.assertEquals(asList(1, 3, 6, 8, 2, 4, 7, 9), order.getCompletelyOrderedItems());
 
        Ordering<Integer> completeOrdering = order.getCompleteOrdering();
Experience pair programming with AI  Get Codota for Java