Skip to content

Instantly share code, notes, and snippets.

@XDo0
Created October 17, 2022 07:10
Show Gist options
  • Save XDo0/ba0bebb6e71428ecf6cfb95dac55da6a to your computer and use it in GitHub Desktop.
Save XDo0/ba0bebb6e71428ecf6cfb95dac55da6a to your computer and use it in GitHub Desktop.
initialize data structure in java
// Java Init an array of List
ArrayList[] graphArrayList = new ArrayList[4];
for(int i=0;i<graphArrayList.length;i++){
graphArrayList[i] = new ArrayList(); //数组的每一个元素都要new一个List对象,来初始化
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment