Karthikeya Boyini has Published 2383 Articles

Java Program to get minimum value with Comparator

karthikeya Boyini

karthikeya Boyini

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

276 Views

First, declare an integer array and add some elements −Integer arr[] = { 40, 20, 30, 10, 90, 60, 700 };Now, convert the above array to List −List list = Arrays.asList(arr);Now, use Comparator and the reverseOrder() method. Using max() will eventually give you the maximum value, but with reverseOrder() it ... Read More

Java Tuple setAt0() method for Pair class

karthikeya Boyini

karthikeya Boyini

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

175 Views

The setAt0() method is used to set the Pair value in JavaTuples and a copy with a new value at the specified index i.e. index 0 here.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following ... Read More

How many types of directive tags JSP supports?

karthikeya Boyini

karthikeya Boyini

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

97 Views

A JSP directive affects the overall structure of the servlet class. It usually has the following form −Directives can have a number of attributes which you can list down as key-value pairs and separated by commas.The blanks between the @ symbol and the directive name, and between the last attribute ... Read More

How to set locate to identify required resource bundle in JSP?

karthikeya Boyini

karthikeya Boyini

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

142 Views

The tag is used to store the given locale in the locale configuration variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueSpecifies a two-part code that represents the ISO-639 language code and an ISO-3166 country code.Yesen_USvariantBrowser-specific variantNoNonescopeScope of the locale configuration variableNoPageExampleResource bundles contain locale-specific objects. Resource bundles contain key/value ... Read More

How to restrict UITextField to take only numbers in Swift?

karthikeya Boyini

karthikeya Boyini

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

5K+ Views

In iOS apps sometimes we need to restrict our text field to take only numbers as an input, this can be done in several ways, let’s see some of them.Method 1: Changing the Text Field Type from storyboard.Select the text field that you want to restrict to numeric input.Go to ... Read More

The contains() method of Quintet class in JavaTuples

karthikeya Boyini

karthikeya Boyini

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

41 Views

Use the contains() method to search a value in the Quintet class in JavaTuples.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following package −import org.javatuples.Quintet;Note − Steps to download and run JavaTuples program. If you ... Read More

vector::resize() vs vector::reserve() in C++

karthikeya Boyini

karthikeya Boyini

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

703 Views

Vectors have the ability to resize itself automatically like dynamic arrays when an element is inserted or deleted, the container handles their storage automatically.The main difference between vector resize() and vector reserve() is that resize() is used to change the size of vector where reserve() doesn’t. reserve() is only used ... Read More

Counting number of positive and negative votes in MySQL?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

To count number of positive and negative votes, you can use CASE statement along with aggregate function SUM().Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Vote int ); Query OK, 0 rows affected (1.70 sec)Insert some records in ... Read More

Search an element of ArrayList in Java

karthikeya Boyini

karthikeya Boyini

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

8K+ Views

An element in an ArrayList can be searched using the method java.util.ArrayList.indexOf(). This method returns the index of the first occurance of the element that is specified. If the element is not available in the ArrayList, then this method returns -1.A program that demonstrates this is given as follows −Example Live ... Read More

ftp_close() function in PHP

karthikeya Boyini

karthikeya Boyini

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

49 Views

The ftp_close() function closes an FTP connection.Syntaxftp_close(con);Parameterscon − The connection to close.ReturnThe ftp_close() function returns TRUE on success or FALSE on failureExampleThe following is an example that login to a connection, works in it to change the directory and then connection is closed −

Advertisements