Trouble calling an ArrayList length to to make a boolean argument.
What am I missing when I try to write these lines to call an ArrayList length to make a boolean argument based on how many Integers are in the ArrayList. import java.util.Scanner; import java.util.ArrayList; import java.util.List; public class PairCalc { public static void main(String[] args) { Scanner rawinput = new Scanner(System.in); List<Integer> arraynumbers = new ArrayList<>(); for(String num: rawinput.nextLine().split("-")) { arraynumbers.add(Integer.parseInt(num)); System.out.println(num); } System.out.println(arraynumbers); System.out.println(arraynumbers.length); if(arraynumbers.length == (1)) { //these are the 2 lines that stump me. System.out.println(arraynumbers.length); } //} /*int x = (arraynumbers.get(0) - 1)*150 + (arraynumbers.get(1)*6) - 6 + (arraynumbers.get(2)); System.out.println("Your Pair = " + x);*/ } } my goal is to do something different if there is only one int in the arraylist. Thanks for any guidance.