From 6809155a9195fa539071f3593f3c304ec89cfe89 Mon Sep 17 00:00:00 2001 From: ericgoebelbecker <@592Gbetz> Date: Fri, 15 Dec 2017 13:19:43 -0500 Subject: [PATCH] BAEL-1374 - same search in each loop. --- .../main/java/com/baeldung/array/SearchArrayTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/array/SearchArrayTest.java b/core-java/src/main/java/com/baeldung/array/SearchArrayTest.java index 8b44138b32..345e1d48f3 100644 --- a/core-java/src/main/java/com/baeldung/array/SearchArrayTest.java +++ b/core-java/src/main/java/com/baeldung/array/SearchArrayTest.java @@ -26,7 +26,7 @@ public class SearchArrayTest { int count = 1000; String[] strings = seedArray(count); for (int i = 0; i < count; i++) { - searchList(strings, "W"); + searchList(strings, "T"); } } @@ -37,7 +37,7 @@ public class SearchArrayTest { int count = 1000; String[] strings = seedArray(count); for (int i = 0; i < count; i++) { - searchSet(strings, "S"); + searchSet(strings, "T"); } } @@ -51,7 +51,7 @@ public class SearchArrayTest { List asList = Arrays.asList(strings); for (int i = 0; i < count; i++) { - asList.contains("W"); + asList.contains("T"); } } @@ -63,7 +63,7 @@ public class SearchArrayTest { String[] strings = seedArray(count); Set asSet = new HashSet<>(Arrays.asList(strings)); for (int i = 0; i < count; i++) { - asSet.contains("S"); + asSet.contains("T"); } } @@ -77,7 +77,7 @@ public class SearchArrayTest { long startTime = System.nanoTime(); for (int i = 0; i < count; i++) { - Arrays.binarySearch(strings, "A"); + Arrays.binarySearch(strings, "T"); } long duration = System.nanoTime() - startTime; //System.out.println("Binary search: " + duration / 10000);