Java ArrayListクラス　java.util.ArrayList

#１，ArrayListの作成方法
>➊ArrayList<String> food = new ArrayList<String>();

#２，ソースコード
>１次元配列

```java:Main.java
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {

		ArrayList<String> food = new ArrayList<String>();

		food.add("pizza");
		food.add("hambueger");
		food.add("hotdog");

		food.set(0, "sushi");
		food.remove(2);
		food.clear();

		for (int i = 0; i < food.size(); i++) {
			System.out.println(food.get(i));
		}
	}

}
```

>２次元配列

```java:Main.java
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {

		ArrayList<ArrayList<String>> groceryList = new ArrayList<>();

		ArrayList<String> bakeryList = new ArrayList<>();

		bakeryList.add("pasta");
		bakeryList.add("garlic bread");
		bakeryList.add("donuts");

		ArrayList<String> produceList = new ArrayList<>();

		produceList.add("tomatoes");
		produceList.add("zucchini");
		produceList.add("peppers");

		ArrayList<String> drinksList = new ArrayList<>();

		drinksList.add("soda");
		drinksList.add("coffee");

		groceryList.add(bakeryList);
		groceryList.add(produceList);
		groceryList.add(drinksList);

		for (int i = 0; i < groceryList.size(); i++) {
			System.out.println(groceryList.get(i));

		}

	}

}
```

>２次元配列とfor-each roop

```java:Main.java
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {

		String[] animals = { "cat", "dog", "rat", "bird" };

		for (String animal : animals) {
			System.out.println(animal);
		}

		ArrayList<String> newAnimals = new ArrayList<>();

		newAnimals.add("cat");
		newAnimals.add("dog");
		newAnimals.add("rat");
		newAnimals.add("bird");

		for (String animal : newAnimals) {
			System.out.println(animal);
		}

	}

}
```

#Java チュートリアル:clipboard:
:coffee: Java テキストファイル（.txt .csv）への出力　java.io.FileWriter : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/2a101f159b1d8447d2cc "here")
:coffee:  Java テキストファイル（.txt .csv）からの入力　java.io.FileReader : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/31c677bb619e73b717a9 "here")
:coffee:  Java モニターからの入力　java.util.Scanner : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/ece84972a49544916cac "here")
:coffee:  Java GUIからの入力　javax.swing.JOptionPane : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/c0b9a2bd9018131b2a48 "here")
:coffee:  Java Mathクラス　Math.sqrt : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/fc5500308a58c3f75887 "here")
:coffee:  Java 乱数の生成　java.util.Random : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/ac357d0fa5b4f70acb9a "here")
:coffee:  Java Stringクラス : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/17b6ea08650d9c8ae072 "here")
:coffee:  Java Wrapperクラス : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/6d2a8480587e40fee90a "here")
:coffee:  Java ArrayListクラス　java.util.ArrayList : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/6478e5851e9a30d0d65c "here")
:coffee:  Java メソッド（method）の作り方とオーバーロード : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/2b132cb5298f9fc97730 "here")
:coffee:  Java printf()メソッド : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/3e471b8006f9500ef3e4 "here")
:coffee:  Java オブジェクト（Object Oriented Programming）とコンストラクタ、スコープ（local,global） : [:white_check_mark:here](https://qiita.com/iwasaki-hub/items/488d41a259aa5a43f921 "here")