xiazcy commented on code in PR #2361:
URL: https://github.com/apache/tinkerpop/pull/2361#discussion_r1403650779
##########
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java:
##########
@@ -174,8 +175,13 @@ else if (boolean.class.isAssignableFrom(type))
else if (String[].class.isAssignableFrom(type)) {
arguments[i] = new String[random.nextInt(10) + 1];
for (int j = 0; j < ((String[])
arguments[i]).length; j++) {
- list.add(((String[]) arguments[i])[j] =
randomString(random));
+ list.add(((String[]) arguments[i])[j] =
arguments[0] + randomString(random)); // adds the first string to all to avoid
duplicates
}
+ // makes sure that no duplicated random string is
created by removing duplicates
+ arguments[i] = Arrays.stream((String[])
arguments[i]).distinct().toArray(String[]::new);
+ final Set<Object> tempSet = new
LinkedHashSet<>(list);
+ list.clear();
+ list.addAll(tempSet);
Review Comment:
There is actually two collections here, the argument array to be passed into
the method and the list saved for the equality comparison part of the test. I
didn't want to change the list adding part, but you are correct I could add
them to a temp set first then add to the list. I'll update that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]