dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37965
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19397: Minor
------------------------------------------------------------
revno: 19397
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-06-14 16:40:28 +0200
message:
Minor
modified:
dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/util/ListUtils.java
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ListUtilsTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/util/ListUtils.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/util/ListUtils.java 2015-06-14 13:15:06 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/util/ListUtils.java 2015-06-14 14:40:28 +0000
@@ -290,25 +290,4 @@
{
return list != null ? list : new ArrayList<T>();
}
-
- /**
- * Moves the item at the given index to the beginning of the given list.
- *
- * @param list the list.
- * @param index the index of the item in the list.
- * @return true if the list was modified, false if not.
- */
- public static <T> boolean moveFirst( List<T> list, int index )
- {
- if ( list == null || list.isEmpty() || index <= 0 || list.size() <= index )
- {
- return false;
- }
-
- T item = list.get( index );
- list.remove( index );
- list.add( 0, item );
-
- return true;
- }
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ListUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ListUtilsTest.java 2015-06-14 13:15:06 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ListUtilsTest.java 2015-06-14 14:40:28 +0000
@@ -75,24 +75,4 @@
list = new ArrayList<>( Arrays.asList( "a", "b", "c", "d", "e", "f", "g", "h" ) );
assertEquals( 0, ListUtils.getDuplicates( list ).size() );
}
-
- @Test
- public void testMoveFirst()
- {
- List<String> list = new ArrayList<>( Arrays.asList( "a", "b", "c", "c", "d", "e", "e", "e", "f" ) );
-
- ListUtils.moveFirst( list, 2 );
-
- assertEquals( "c", list.get( 0 ) );
- assertEquals( "a", list.get( 1 ) );
- assertEquals( "b", list.get( 2 ) );
-
- list = new ArrayList<>( Arrays.asList( "a", "b", "c", "c", "d", "e", "e", "e", "f" ) );
-
- ListUtils.moveFirst( list, 20 );
-
- assertEquals( "a", list.get( 0 ) );
- assertEquals( "b", list.get( 1 ) );
- assertEquals( "c", list.get( 2 ) );
- }
}