Karthikeya Boyini has Published 2383 Articles

Remove duplicate elements in Java with HashSet

karthikeya Boyini

karthikeya Boyini

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

11K+ Views

Set implementations in Java has only unique elements. Therefore, it can be used to remove duplicate elements.Let us declare a list and add elements −List < Integer > list1 = new ArrayList < Integer > (); list1.add(100); list1.add(200); list1.add(300); list1.add(400); list1.add(400); list1.add(500); list1.add(600); list1.add(600); list1.add(700); list1.add(400); list1.add(500);Now, use the HashSet ... Read More

Provider getName() method in Java

karthikeya Boyini

karthikeya Boyini

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

95 Views

The name of the provider can be obtained using the getName() method in the class java.security.Provider. This method requires no parameter and it returns the name of the provider as required.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo {    public ... Read More

How do I get the average string length in MySQL?

karthikeya Boyini

karthikeya Boyini

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

869 Views

To get the average string length in MySQL, we will work around a query that gets rows from 1 to 10 and displays the result.Let us first create a table. The query to create a table is as follows −mysql> create table AverageString -> ( ... Read More

Duration getSeconds() method in Java

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

The value of a duration in seconds can be obtained using the getSeconds() method in the Duration class in Java. This method requires no parameters and it returns the duration value in seconds.A program that demonstrates this is given as follows −Example Live Demoimport java.time.Duration; public class Demo {    public ... Read More

Dynamic Channel Allocation in computer network

karthikeya Boyini

karthikeya Boyini

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

5K+ Views

When there are more than one user who desire to access a shared network channel, an algorithm is deployed for channel allocation among the competing users. Dynamic channel allocation encompasses the channel allocation schemes where channels are allotted to users dynamically as per their requirements, from a central pool.Working PrincipleIn ... Read More

What does % stand for in host column and how to change user's password?

karthikeya Boyini

karthikeya Boyini

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

200 Views

The localhost means you can access from same machine while from % the remote host access is possible. The syntax is as follows to change the user password.SET PASSWORD FOR 'yourUserName'@'localhost' ='yourPassword';First check the user and host from MySQL.user table. The query is as follows −mysql> select user, host from ... Read More

Instant now() Method in Java

karthikeya Boyini

karthikeya Boyini

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

8K+ Views

The current instant from the system UTC clock can be obtained using the now() method in the Instant class in Java. This method requires no parameters and it returns the current instant from the system UTC clock.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class ... Read More

Rotate a List in Java

karthikeya Boyini

karthikeya Boyini

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

160 Views

To rotate a list in Java, let us first create a List and add elements −List < Integer > list = new ArrayList < Integer > (); list.add(5); list.add(10); list.add(15); list.add(20); list.add(25); list.add(30); list.add(35); list.add(40); list.add(45);Now, rotate the list −Collections.reverse(list);Example Live Demoimport java.util.ArrayList; import java.util.Collections; import java.util.List; public class Demo { ... Read More

Set Optimal MySQL configuration in my.cnf?

karthikeya Boyini

karthikeya Boyini

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

169 Views

First, you need to open my.cnf file. The following is the query to get the directory location of the config file on Windows −mysql> select @@datadir;Output+---------------------------------------------+ | @@datadir ... Read More

Instant plusSeconds() method in Java

karthikeya Boyini

karthikeya Boyini

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

377 Views

An immutable copy of a instant where some seconds are added to it can be obtained using the plusSeconds() method in the Instant class in Java. This method requires a single parameter i.e. the number of seconds to be added and it returns the instant with the added seconds.A program ... Read More

Advertisements