Using values from a for loop in a function outside of it
问题 I need to take values that I find from inside a for loop to use in a function that isn't inside the loop, and I can't figure out how to do this. What I am hoping to accomplish is to extract values from a key in a hashmap to then plot in a JTable only if that row is selected (using a ListSelectionListener ). This way, I can avoid graphing a hundred tables which would save a lot of time. Also I am using DefaultTableModel . This is my for loop: tableMaker(model); for(Map.Entry<String