First commit of partial RosettaCode contents.

Pushing this for testing purposes. Lots of work still needed.
This commit is contained in:
Ingy döt Net 2013-04-08 13:02:41 -07:00
commit 1e05ecd7ee
781 changed files with 9080 additions and 0 deletions

View file

@ -0,0 +1,11 @@
String[] haystack = {"Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"};
OUTERLOOP:
for (String needle : new String[]{"Washington","Bush"}) {
for (int i = 0; i < haystack.length; i++)
if (needle.equals(haystack[i])) {
System.out.println(i + " " + needle);
continue OUTERLOOP;
}
System.out.println(needle + " is not in haystack");
}

View file

@ -0,0 +1,12 @@
import java.util.List;
import java.util.Arrays;
List<String> haystack = Arrays.asList("Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo");
for (String needle : new String[]{"Washington","Bush"}) {
int index = haystack.indexOf(needle);
if (index < 0)
System.out.println(needle + " is not in haystack");
else
System.out.println(index + " " + needle);
}