Created
October 24, 2018 11:46
-
-
Save micycle1/a8c74e5abac5109895eeef9ffc8fde07 to your computer and use it in GitHub Desktop.
Guava ArrayTable from int[]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.collect.ArrayTable; | |
import com.google.common.collect.Table; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
int[] rows = new int[]{1,2,3} | |
int[] columns = new int[]{4,5,6,7} | |
List<Integer> row = Arrays.stream(rows).boxed().collect(Collectors.toList()); | |
List<Integer> column = Arrays.stream(columns).boxed().collect(Collectors.toList()); | |
Table<Integer, Integer, Integer> table = ArrayTable.create(row, column); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment