LANG-1402: refactored to return default value on negative index

This commit is contained in:
MarkDacek 2018-07-08 19:11:19 -04:00
parent 625fbccaa9
commit 7721302ae5
2 changed files with 2 additions and 2 deletions

View File

@ -8700,7 +8700,7 @@ public class ArrayUtils {
}
if(index < 0 ){
index = 0;
return defaultReturn;
}
return array[index];

View File

@ -5125,7 +5125,7 @@ public class ArrayUtilsTest {
assertEquals("Test", ArrayUtils.get(array, 10, "Test"));
//negative index
assertEquals("Hello World", ArrayUtils.get(array, -1));
assertEquals("Default", ArrayUtils.get(array, -1, "Default"));
}
@Test