Code example for TreeSet

Methods: addcontains

	private static void store_ip() { 
		// Store the IP Address in a Table; 
		if (is_input_valid)
			if (!ts.contains(ip)) {
				System.out.println("IP address added into the table");
			} else 
				System.out.println("IP Already Exist in the table");
			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})");
Connect your IDE to all the code out there  Get Codota for Java