Code example for TreeSet

Methods: add, contains

0
	} 
 
	private static void store_ip() { 
		// Store the IP Address in a Table; 
		if (is_input_valid)
			if (!ts.contains(ip)) {
				ts.add(ip);
				System.out.println("IP address added into the table");
			} else 
				System.out.println("IP Already Exist in the table");
		else 
			System.err.print("\n Invalid IP Address");
	} 
 
	private static void get_input_ip() { 
 
		try { 
			System.out.println("\n Enter the IP Address : ");
			ip = br.readLine();
			is_input_valid = ip.matches("([0-9]{1,3}[.]){3}([0-9]{1,3})");
		} catch (Exception e) {