Karthikeya Boyini has Published 2383 Articles

Get Size of TreeSet in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

396 Views

To get the size of TreeSet, use the size() method.Create a TreeSet and add elements to it −TreeSet tSet = new TreeSet(); tSet.add("78"); tSet.add("56"); tSet.add("88"); tSet.add("12");Now, get the size of the TreeSet −tSet.size()The following is an example to get the size of TreeSet in Java −Example Live Demoimport java.util.*; public class ... Read More

Java IdentityHashMap clear() method

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

77 Views

Clear the IdentityHashMap using the clear() method.Create an IdentityHashMap and add elements to it −Map m = new IdentityHashMap(); m.put("1", 100); m.put("2", 200); m.put("3", 300); m.put("4", 150); m.put("5", 110); m.put("6", 50); m.put("7", 90); m.put("8", 250);Now, let us use the clear() method to remove all the elements −m.clear()The following is an ... Read More

Get Tail Set from TreeSet in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

151 Views

To get the Tail Set from TreeSet, use the tailSet() method. Tail Set begins from a point and returns the elements greater than the element set in the beginning.First, create a TreeSet and add elements −TreeSet set = new TreeSet(); set.add("78"); set.add("56"); set.add("88"); set.add("54"); set.add("76"); set.add("34");Now, get the Tail Set ... Read More

ftp_alloc() function in PHP

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

85 Views

The ftp_alloc() function allocates space for a file to be uploaded to the FTP server.Syntaxftp_alloc(connection, size_of_file, res);Parametersconnection − The FTP connection to usesize_of_file − The number of bytes to allocateres − A variable to store the server responseReturnThe ftp_alloc() function returns TRUE on success or FALSE on failureExampleThe following is ... Read More

Check if a particular value exists in Java TreeSet

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

582 Views

The contains() method is used to check if a particular value exists.First, create a TreeSet and add elements −TreeSet set = new TreeSet(); set.add("34"); set.add("12"); set.add("67"); set.add("54"); set.add("76"); set.add("49");Use the contains() method to check if a value exist or not i.e. 12 in this case −set.contains("12")The following is an example ... Read More

ftp_chdir() function in PHP

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

104 Views

The ftp_chdir() function changes the current directory on the FTP server.Syntaxftp_chdir(con, dir)Parameterscon − The FTP connectiondir − The directory to change toReturnThe ftp_chdir() function returns TRUE on success or FALSE on failure.ExampleThe following is an example wherein the current directory is changed −

Concatenated string with uncommon characters in Python?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:23

726 Views

Here two strings are given, first we have to remove all the common element from the first string and uncommon characters of the second string have to be concatenated with uncommon element of first string. Example Input >> first string::AABCD Second string:: MNAABP Output >> CDMNP Algorithm ... Read More

Get similar words suggestion using Enchant in Python

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:23

272 Views

When we write something, many times happen with us that we misspelled some words. To overcome this problem, Python provides Enchant module. This is mainly used to check the spelling of words and suggest corrections for words that are miss-spelled. It is also used in many popular spellchecking packages to ... Read More

Python program to find Intersection of two lists?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:23

420 Views

Intersection operation means, we have to take all the common elements from List1 and List 2 and all the elements store in another third list. List1::[1, 2, 3] List2::[2, 3, 6] List3::[2, 3] Algorithm Step 1: input lists. Step 2: first traverse all the elements in the ... Read More

Second most repeated word in a sequence in Python?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:23

644 Views

The string is given, our task is to find out the second repeated word. Here we Counter(iterator) for creating dictionary which contains word as key and its frequency as value. Algorithm Step 1: Create user define list. Step 2: Then convert list into a dictionary. Step 2: Next get ... Read More

Advertisements