Chandu yadav has Published 1163 Articles

Order a MySQL table by two columns?

Chandu yadav

Chandu yadav

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

374 Views

Order a MySQL table by two columns with the help of below syntax −order by yourColumnName1 DESC, yourColumnName2 DESC;Let us first create a table for our example −mysql> create table OrderByDemo -> ( -> StudentId int, -> StudentName varchar(100), ... Read More

Remove an element from IdentityHashMap in Java

Chandu yadav

Chandu yadav

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

124 Views

Use the remove() method to remove an element from IdentityHashMap.Let us create IdentityHashMap and add some elementsMap m = new IdentityHashMap(); m.put("1", 100); m.put("2", 200); m.put("3", 300); m.put("4", 150); m.put("5", 110); m.put("6", 50); m.put("7", 90); m.put("8", 250); m.put("9", 350); m.put("10", 450);Let’s say you need to remove 2 from the Map. ... Read More

How to build a Horizontal ListView with RecyclerView in Android?

Chandu yadav

Chandu yadav

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

1K+ Views

Before getting into example, we should know what is Recycler view in android. Recycler view is more advanced version of list view and it works based on View holder design pattern. Using recycler view we can show grids and list of items.This example demonstrate about how to build a horizontal ... Read More

Check if a Java HashSet Collection contains another Collection

Chandu yadav

Chandu yadav

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

811 Views

To check whether a HashSet contains another, use the contains() method.Set the first HashSetString strArr[] = { "P", "Q", "R" }; Set set1 = new HashSet(Arrays.asList(strArr));Set the second HashSetString strArr = new String[] { "P", "Q"}; Set set2 = new HashSet(Arrays.asList(strArr));Check nowset1.containsAll(set2))The following is an example to check if a ... Read More

Get the size of the IdentityHashMap in Java

Chandu yadav

Chandu yadav

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

88 Views

To get the size of IdentityHashMap, use the size() method. It returns the count of elements in the IdentityHashMap.Let us first create a IdentityHashMap and add some elements to itMap m = new IdentityHashMap(); m.put("1", 100); m.put("2", 200); m.put("3", 300); m.put("4", 150); m.put("5", 110); m.put("6", 50); m.put("7", 90); m.put("8", 250); ... Read More

How to implement Android Pull-to-Refresh?

Chandu yadav

Chandu yadav

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

474 Views

Before getting into example, we should know what is Pull to refresh layout in android . we can call pull to refresh in android as swipe-to-refresh. when you swipe screen from top to bottom it will do some action based on setOnRefreshListener.This example demonstrate about how to implement android pull ... Read More

How to implement Android TextInputLayout

Chandu yadav

Chandu yadav

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

2K+ Views

Before getting into example, we should know what is TextInputLayout in android. TextInputLayout is extended by Linear Layout. It going to act as a wrapper for edit text and shows flatting hint animation for edit text.This example demonstrate about how to implement Android TextInputLayout.Step 1 − Create a new project ... Read More

Check for the existence of a value in Java IdentityHashMap

Chandu yadav

Chandu yadav

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

95 Views

Use the containsValue() method to check whether a particular value exists in IdentityHashMap or not.Create a IdentityHashMapMap m = newIdentityHashMap(); m.put("1", 100); m.put("2", 200); m.put("3", 300); m.put("4", 150); m.put("5", 110); m.put("6", 50); m.put("7", 90); m.put("8", 250); m.put("9", 350); m.put("10", 450);Now, let’s say we need to check whether value 100 exists ... Read More

Count number of rows in each table in MySQL?

Chandu yadav

Chandu yadav

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

3K+ Views

To get the count of rows, you need to use information_schema.tables. The syntax is as follows.SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ‘yourDatabaseName’;Let us implement the above syntax for a database with the name ‘test’. The query is as follows displaying the table ... Read More

Get navigable key set in java from NavigableMap

Chandu yadav

Chandu yadav

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

67 Views

The navigableKeySet() method is used to get view of the Map from NavigableMap.Let us first create a NavigableMapNavigableMap n = new TreeMap();Add some elements in the NavigableMapn.put("A", 498); n.put("B", 389); n.put("C", 868); n.put("D", 988); n.put("E", 686); n.put("F", 888); n.put("G", 999); n.put("H", 444); n.put("I", 555); n.put("J", 666);Get Navigable Key Set nown.navigableKeySet()The ... Read More

Advertisements