- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34472 Articles for Programming
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
101 Views
The contains() method of the ArrayBlockingQueue class is used to search for an element in the queue. If the element exist in the queue, TRUE is returned.The syntax is as follows −boolean contains(Object ob)Here, ob is the element to be searched.To work with ArrayBlockingQueue class, you need to import the following package −import java.util.concurrent.ArrayBlockingQueue;The following is an example to implement contains() method of Java ArrayBlockingQueue class −Example Live Demoimport java.util.concurrent.ArrayBlockingQueue; public class Demo { public static void main(String[] args) throws InterruptedException { ArrayBlockingQueue q = new ArrayBlockingQueue(10); q.add(200); q.add(310); ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
61 Views
To search for a value in the LabelValue tuple in Java, use the contains() method. It returns a boolean value. TRUE is returned if the value exists, else FALSE is the return value. Let us first see what we need to work with JavaTuples. To work with LabelValue class in JavaTuples, you need to import the following package −import org.javatuples.LabelValue;Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
96 Views
To get the size of the LabelValue tuple in Java, use the getSize() method. Let us first see what we need to work with JavaTuples. To work with LabelValue class in JavaTuples, you need to import the following package −import org.javatuples.LabelValue;Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples −Steps − How to run JavaTuples program in EclipseThe following is an ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
264 Views
To set LabelValue value and label in Java, use the setLabel() and setValue() methods. Let us first see what we need to work with JavaTuples. To work with LabelValue class in JavaTuples, you need to import the following package −import org.javatuples.LabelValue;Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples −Steps − How to run JavaTuples program in EclipseThe following is an ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
69 Views
The indexOf() method is inherited from the AbstractList class. It is used to return the index of the first occurrence of the specified element in this list. If the list is empty, it returns -1.The syntax is as follows −public int indexOf(Object ele)Here, ele is the element for which you want the index.To work with the AbstractSequentialList class in Java, you need to import the following package −import java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList indexOf() method in Java −Example Live Demoimport java.util.LinkedList; import java.util.AbstractSequentialList; public class Demo { public static void main(String[] args) { ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
44 Views
An immutable copy of a LocalTime object where some seconds are added to it can be obtained using the plusSeconds() method in the LocalTime class in Java. This method requires a single parameter i.e. the number of seconds to be added and it returns the LocalTime object with the added seconds.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { LocalTime lt = LocalTime.now(); System.out.println("The current LocalTime is: " + lt); System.out.println("The LocalTime with 5 seconds added is: ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
39 Views
An immutable copy of a LocalTime object where some minutes are added to it can be obtained using the plusMinutes() method in the LocalTime class in Java. This method requires a single parameter i.e. the number of minutes to be added and it returns the LocalTime object with the added minutes.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { LocalTime lt = LocalTime.now(); System.out.println("The current LocalTime is: " + lt); System.out.println("The LocalTime with 15 minutes added is: ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
39 Views
The time in the form of nanoseconds of the day can be obtained using the toNanoOfDay() method in the LocalTime class in Java. This method requires no parameters and it returns the time in the form of nanoseconds of the day.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalTime lt = LocalTime.parse("05:15:30"); System.out.println("The LocalTime is: " + lt); System.out.println("The nanoseconds of the day are: " + lt.toNanoOfDay()); } }OutputThe LocalTime is: 05:15:30 The nanoseconds of ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
36 Views
The time in the form of seconds of the day can be obtained using the toSecondOfDay() method in the LocalTime class in Java. This method requires no parameters and it returns the time in the form of seconds of the day.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalTime lt = LocalTime.parse("05:15:30"); System.out.println("The LocalTime is: " + lt); System.out.println("The seconds of the day are: " + lt.toSecondOfDay()); } }OutputThe LocalTime is: 05:15:30 The seconds of ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
33 Views
An immutable copy of a LocalTime with the seconds altered as required is done using the method withSecond() in the LocalTime class in Java. This method requires a single parameter i.e. the second that is to be set in the LocalTime and it returns the LocalTime with the second altered as required.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalTime lt1 = LocalTime.parse("23:15:30"); System.out.println("The LocalTime is: " + lt1); LocalTime lt2 = lt1.withSecond(45); ... Read More