メソッドが単一の場合、正常に機能します。
String as = System.getProperty("line.separator");
ArrayList<String> products = new ArrayList<String>();
products.add("Banana" +as+ "Its color is yellow.");
products.add("Orange" +as+ "Orange is a sour fruit.");
products.add("Onion" +as+ "Onion usually used on Pizza");
複数に分割されている場合。それは動作しません。
String as = System.getProperty("line.separator");
ArrayList<String> products = new ArrayList<String>();
addFirstThousand(products);
addSecondThousand(products);
private void addFirstThousand(ArrayList<String> products) {
products.add("Banana" +as+ "Its color is yellow.");
products.add("Orange" +as+ "Orange is a sour fruit.");
products.add("Onion" +as+ "Onion usually used on Pizza");
}
private void addSecondThousand(ArrayList<String> products) {
products.add("Apple" +as+ "Apple is a big corporation");
products.add("Love" +as+ "Love is releted to heart");
products.add("Pizza" +as+ "It's origineted from Italy");
}
理解を容易にするために:
これを複数に分割するにはどうすればよいですか?