Permalink
Browse files

Add additional example with duplicate values

  • Loading branch information...
LadyCailin committed Oct 25, 2018
1 parent 8195247 commit a7e17987ed89841af3b1c5652072a1fc0eb549fa
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/main/java/com/laytonsmith/core/functions/ArrayHandling.java
@@ -1180,6 +1180,7 @@ public Construct exec(Target t, Environment env, Construct... args) throws Confi
}
@api
@seealso({array_intersect.class})
public static class array_merge extends AbstractFunction implements Optimizable {
@Override
@@ -3023,6 +3024,7 @@ public Version since() {
}
@api
@seealso({array_merge.class})
public static class array_intersect extends AbstractFunction {
@MEnum("ArrayIntersectComparisonMode")
@@ -3160,7 +3162,8 @@ public String docs() {
+ " be different, and so in that case using STRICT_EQUALS has a lower performance for no gain,"
+ " but there may be some cases where using"
+ " the hash code is not desirable. EQUALS is necessary if you wish to disregard typing, so that"
+ " array(1, 2, 3) and array('1', '2', '3') are considered equal.";
+ " array(1, 2, 3) and array('1', '2', '3') are considered equal. Duplicate values in the left"
+ " array are duplicated, but duplicates in the right are not.";
}
@Override
@@ -3195,7 +3198,13 @@ public Version since() {
+ "\tarray(array(id: 1, pos: 'right')),\n"
+ "\tclosure(@a, @b) {\n"
+ "\t\treturn(@a['id'] == @b['id']);\n"
+ "})")
+ "})"),
new ExampleScript("Demonstrates behavior with duplicate values", "msg(array_intersect(\n"
+ "\tarray(1, 1, 1, 2, 3),\n"
+ "\tarray(1, 2)));\n"
+ "msg(array_intersect(\n"
+ "\tarray(1, 2, 3),\n"
+ "\tarray(1, 1, 1)));")
};
}

0 comments on commit a7e1798

Please sign in to comment.