Code example for Scanner

Methods: hasNextIntnextInt

0
		// using the string. 
		public int compare(BaseObject o0, BaseObject o1) {
			String ln0 = o0.getLocalizedName();
			String ln1 = o1.getLocalizedName();
			Scanner s0 = new Scanner(ln0);
			Scanner s1 = new Scanner(ln1);
			if (s0.hasNextInt() && s1.hasNextInt()) {
				Integer n0 = s0.nextInt();
				Integer n1 = s1.nextInt();
				return n0.compareTo(n1);
			} 
			return ln0.compareTo(ln1);
		} 
	} 
}