- 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
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
4K+ Views
The difference between two LocalTime objects can be obtained using the until() method in the LocalTime class in Java. This method requires two parameters i.e. the end time for the LocalTime object and the Temporal unit. Also, it returns the difference between two LocalTime objects in the Temporal unit specified.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.*; public class Demo { public static void main(String[] args) { LocalTime lt1 = LocalTime.parse("10:15:30"); LocalTime lt2 = LocalTime.parse("12:21:30"); System.out.println("The first LocalTime is: " + lt1); ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
83 Views
The range of values for a ChronoField can be obtained using the range() method in the LocalTime class in Java. This method requires a single parameter i.e. the ChronoField for which the range of values is required and it returns the range of values.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.ChronoField; import java.time.temporal.ValueRange; public class Main { public static void main(String[] args) { LocalTime lt = LocalTime.parse("11:19:50"); System.out.println("The LocalTime is: " + lt); ValueRange range = lt.range(ChronoField.MICRO_OF_SECOND); System.out.println("The range of MICRO_OF_SECOND ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
50 Views
An immutable copy of a LocalDateTime with the day of month altered as required is done using the method withDayOfMonth() in the LocalDateTime class in Java. This method requires a single parameter i.e. the day of month that is to be set in the LocalDateTime and it returns the LocalDateTime with the day of month 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) { LocalDateTime ldt1 = LocalDateTime.parse("2019-02-18T23:15:30"); System.out.println("The LocalDateTime is: " + ldt1); LocalDateTime ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
86 Views
The findAny() method of the IntStream class in Java is used to return an OptionalInt describing some element of the stream, or an empty OptionalInt if the stream is empty.The syntax is as follows −OptionalInt findAny()Here, OptionalInt is a container object which may or may not contain an int value.Create an IntStream and add some elements −IntStream intStream = IntStream.of(20, 35, 50, 60, 80, 100);Now, return any of the element of the stream using findAny() in Java −OptionalInt res = intStream.findAny();The following is an example to implement IntStream findAny() method in Java −Example Live Demoimport java.util.*; import java.util.stream.IntStream; public class ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
92 Views
The iterator() method of the AbstractCollection class in Java is used to return an iterator over the elements contained in this collection.The syntax is as follows −public abstract Iterator iterator()To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;For Iterator, import the following package −import java.util.Iterator;The following is an example to implement the AbstractCollection iterator() method in Java −Example Live Demoimport java.util.Iterator; import java.util.ArrayList; import java.util.AbstractCollection; public class Demo { public static void main(String[] args) { AbstractCollection absCollection = new ArrayList(); absCollection.add("Laptop"); absCollection.add("Tablet"); absCollection.add("Mobile"); ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
236 Views
The isEmpty() method of the AbstractCollection class checks whether the collection is empty or not i.e. whether it has zero elements. It returns if the Collectionn has no elements.The syntax is as follows −public boolean isEmpty()To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;The following is an example to implement AbstractCollection isEmpty() method in Java −Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo { public static void main(String[] args) { AbstractCollection absCollection = new ArrayList(); absCollection.add("Laptop"); absCollection.add("Tablet"); absCollection.add("Mobile"); absCollection.add("E-Book ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
240 Views
The containsAll() method checks for all the elements in the specified collection. It returns TRUE if this collection has all the elements. The methods check for each element one by one to see if it's contained in this collection.The syntax is as follows −public boolean containsAll(Collection c)To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;The following is an example to implement AbstractCollection containsAll() method in Java −Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo { public static void main(String[] args) { AbstractCollection absCollection1 = new ArrayList(); absCollection1.add("These"); ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
71 Views
To fetch the value from an Octet Tuple, use the getValueX() method. Here X is the index for which you want the value.For example, to fetch the 5th element i.e. 4th index, use the getValueX() method as −getValue(4);Let us first see what we need to work with JavaTuples. To work with Octet class in JavaTuples, you need to import the following package −import org.javatuples.Octet;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. ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
81 Views
Create Octel Tuple from List collection as well using the fromCollection() method in Java. Let us first see what we need to work with JavaTuples. To work with Octet class in JavaTuples, you need to import the following package −import org.javatuples.Octet;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)
81 Views
To add elements to the AbstractCollection class, use the add() method. For example −absCollection.add("These"); absCollection.add("are"); absCollection.add("demo");To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;The following is an example to add elements to AbstractCollection class in Java −Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo { public static void main(String[] args) { AbstractCollection absCollection = new ArrayList(); absCollection.add("These"); absCollection.add("are"); absCollection.add("demo"); absCollection.add("elements"); System.out.println("Displaying elements in the AbstractCollection: " + absCollection); } }OutputDisplaying elements in the AbstractCollection: [These, ... Read More