
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 33676 Articles for Programming

186 Views
The poll() method of the ArrayBlockingQueue class in Java retrieves and removes the head of this queue, or returns null if this queue is empty.The syntax is as follows:E poll()To work with ArrayBlockingQueue class, you need to import the following package:import java.util.concurrent.ArrayBlockingQueue;The following is an example to implement poll() 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); q.add(400); q.add(450); q.add(500); ... Read More

271 Views
To get the geographic coordinates of the place that is longitude and latitude of the place we can use google maps geocoding api.RequirementTo get the coordinates of a place, we required geocoding api & you can get it from below link:https://developers.google.com/maps/documentation/geocoding/get-api-keyApart from api_key, we are going to use pythonRequest module (fetch the coordinates)Json module (for conversion).Below is the program to achieve the same:# Import required library import requests import json #Enter the place name place = input("Please enter place name: ") #Place your google map API_KEY to a variable apiKey = 'YOUR_API_KEY' #Store google geocoding api url in a variable ... Read More

70 Views
The empty() method of the DoubleStream class in Java returns an empty sequential DoubleStream.The syntax is as follows:static DoubleStream empty()To use the DoubleStream class in Java, import the following package:import java.util.stream.DoubleStream;Let us create an empty DoubleStream:DoubleStream doubleStream = DoubleStream.empty();Now, let us check the number of elements in the stream. It will be 0, since the stream is set to empty:doubleStream.count()The following is an example to implement DoubleStream empty() method in Java:Example Live Demoimport java.util.stream.DoubleStream; public class Demo { public static void main(String[] args) { DoubleStream doubleStream = DoubleStream.empty(); System.out.println("Number of elements in the stream ... Read More

806 Views
We almost all use google maps to check distance between source and destination and check the travel time. For developers and enthusiasts, google provide ‘google distance matrix API’ to calculate the distance and duration between two places.To use google distance matrix api, we need google maps API keys, which you can get from below link:https://developers.google.com/maps/documentation/distance-matrix/get-api-keyRequired librariesWe can accomplish this by using different python library, like:PandasgooglemapsRequestsJsonI am using very basic requests and json library. Using pandas you can fill multiple source and destination places at a time and get the result in csv file.Below is the program to implement the same:# ... Read More

126 Views
The toArray() method returns an array containing the elements of this stream.The syntax is as follows:double[] toArray()To use the DoubleStream class in Java, import the following package:import java.util.stream.DoubleStream;Create DoubleStream and add some elements:DoubleStream doubleStream = DoubleStream.of(20.7, 30.5, 45.9, 60.2, 75.9, 88.3, 95.2);Now, use the toArray() method to return an array with the stream elements:double[] myArr = doubleStream.toArray();The following is an example to implement DoubleStream toArray() method in Java:Example Live Demoimport java.util.*; import java.util.stream.DoubleStream; public class Demo { public static void main(String[] args) { DoubleStream doubleStream = DoubleStream.of(20.7, 30.5, 45.9, 60.2, 75.9, 88.3, 95.2); double[] ... Read More

118 Views
The findAny() method of the LongStream class in Java returns an OptionalLong describing some element of the stream, or an empty OptionalLong if the stream is empty.The syntax is as follows:OptionalLong findAny()Here, OptionalLong is a container object which may or may not contain a long value.To use the LongStream class in Java, import the following package:import java.util.stream.LongStream;The following is an example to implement LongStream findAny() method. The isPresent() method of the OptionalLong class returns true if the value is present:Exampleimport java.util.OptionalLong; import java.util.stream.LongStream; public class Demo { public static void main(String[] args) { LongStream longStream = ... Read More

141 Views
To create Ennead Tuple, you can use the with() method. With that, you can also add elements to it. Let us first see what we need to work with JavaTuples. To work with Ennead class in JavaTuples, you need to import the following package:import org.javatuples.Ennead;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 ... Read More

954 Views
We generally open the browser to search for a specific site/place on google maps. And if you need to do this task multiple times a day, it becomes very boring. Now you can automate this task where your browser will open automatically and the webpage will show you the google maps of your desired location.InstallationFor this purpose, I’m going to use the paperclip package. As this is not the standard package, we need to install it using pip.>pip install pyperclip Collecting pyperclip Downloading https://files.pythonhosted.org/packages/2d/0f/4eda562dffd085945d57c2d9a5da745cfb5228c02bc90f2c74bbac746243/pyperclip-1.7.0.tar.gz Building wheels for collected packages: pyperclip Building wheel for pyperclip (setup.py) ... done Stored in directory: ... Read More

99 Views
The toArray() method of the ArrayBlockingQueue class returns an array containing all of the elements in this queue.The syntax is as follows:Object[] toArray()To work with ArrayBlockingQueue class, you need to import the following package:import java.util.concurrent.ArrayBlockingQueue;The following is an example to implement toArray() method of Java ArrayBlockingQueue class:Example Live Demoimport java.util.ArrayList; import 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); q.add(400); q.add(450); q.add(500); q.add(550); q.add(700); ... Read More