@Test public void testSortVirtualResources() throws Exception { List<VirtualResource> virtualResources = new ArrayList<VirtualResource>(); Assert.assertTrue(ActionResolverUtils.sortVirtualResources(virtualResources) == virtualResources); VirtualResource virtualResource = mock(VirtualResource.class); VirtualResource virtualResource1 = mock(VirtualResource.class); virtualResources.add(virtualResource); virtualResources.add(virtualResource1); when(virtualResource.getOrder()).thenReturn(1L); when(virtualResource1.getOrder()).thenReturn(0L); Assert.assertTrue(ActionResolverUtils.sortVirtualResources(virtualResources).get(0) == virtualResource1); }
protected static List<VirtualResource> sortVirtualResources(List<VirtualResource> virtualResources) { if ( virtualResources.isEmpty() || 1 == virtualResources.size() ) { return virtualResources; } List<VirtualResource> sortedVirtualResources = new ArrayList<VirtualResource>(virtualResources.size()); sortedVirtualResources.addAll(virtualResources); for ( VirtualResource virtualResource : virtualResources ) { sortedVirtualResources.set(virtualResource.getOrder().intValue(), virtualResource); } return sortedVirtualResources; }
ActionResolverUtils { protected static List<VirtualResource> sortVirtualResources(List<VirtualResource> virtualResources) { if ( virtualResources.isEmpty() || 1 == virtualResources.size() ) { return virtualResources; } List<VirtualResource> sortedVirtualResources = new ArrayList<VirtualResource>(virtualResources.size()); sortedVirtualResources.addAll(virtualResources); for ( VirtualResource virtualResource : virtualResources ) { sortedVirtualResources.set(virtualResource.getOrder().intValue(), virtualResource); } return sortedVirtualResources; } }
ActionResolverUtils { protected static List<VirtualResource> sortVirtualResources(List<VirtualResource> virtualResources) { if ( virtualResources.isEmpty() || 1 == virtualResources.size() ) { return virtualResources; } List<VirtualResource> sortedVirtualResources = new ArrayList<VirtualResource>(virtualResources.size()); sortedVirtualResources.addAll(virtualResources); for ( VirtualResource virtualResource : virtualResources ) { sortedVirtualResources.set(virtualResource.getOrder().intValue(), virtualResource); } return sortedVirtualResources; }  }
ActionResolverUtils { protected static List<VirtualResource> sortVirtualResources(List<VirtualResource> virtualResources) { if ( virtualResources.isEmpty() || 1 == virtualResources.size() ) { return virtualResources; } List<VirtualResource> sortedVirtualResources = new ArrayList<VirtualResource>(virtualResources.size()); sortedVirtualResources.addAll(virtualResources); for ( VirtualResource virtualResource : virtualResources ) { sortedVirtualResources.set(virtualResource.getOrder().intValue(), virtualResource); } return sortedVirtualResources; }   }
ActionResolverUtils { protected static List<VirtualResource> sortVirtualResources(List<VirtualResource> virtualResources) { if ( virtualResources.isEmpty() || 1 == virtualResources.size() ) { return virtualResources; } List<VirtualResource> sortedVirtualResources = new ArrayList<VirtualResource>(virtualResources.size()); sortedVirtualResources.addAll(virtualResources); for ( VirtualResource virtualResource : virtualResources ) { sortedVirtualResources.set(virtualResource.getOrder().intValue(), virtualResource); } return sortedVirtualResources; }    }