Convert List Collection into a Dictionary in Java

Nikitha N
Updated on 30-Jul-2019 22:30:21

2K+ Views

Following is an example to convert a list collection into a dictionary in Java.Example Live Demoimport java.util.ArrayList; import java.util.Dictionary; import java.util.Hashtable; public class CollectionDictionary {    public static void main(String[] args) {       ArrayList list = new ArrayList();       list.add("JavaFx");       list.add("Java");       list.add("WebGL");       list.add("OpenCV");       System.out.println(list);       Dictionary dictionary = new Hashtable();       Hashtable hashTable = new Hashtable();       hashTable.put(1, list.get(0));       hashTable.put(2, list.get(1));       hashTable.put(3, list.get(2));       hashTable.put(4, list.get(3));       System.out.println(hashTable);    } }Output[JavaFx, Java, WebGL, OpenCV] {4=OpenCV, 3=WebGL, 2=Java, 1=JavaFx}

Get List of Tables in Default MySQL Database

George John
Updated on 30-Jul-2019 22:30:21

493 Views

As we know that the default MySQL database would be the database that is currently in use for subsequent queries. We can get the list of tables in that database by using SHOW TABLES statement. mysql> SHOW TABLES; +------------------+ | Tables_in_sample | +------------------+ | employee | | new_student | | student | +------------------+ 3 rows in set (0.00 sec) The above statement shows the list of table in Sampledatabase.

Redirect URL to a Different Website After Few Seconds

George John
Updated on 30-Jul-2019 22:30:21

7K+ Views

Page redirection is a situation where you clicked a URL to reach a page X but internally you were directed to another page Y. It happens due to page redirection. To redirect URL to a different website after few seconds, use the META tag, with the content attribute. The attributes set the seconds. The following is an example of redirecting current page to another website in 10 seconds. The content attribute sets the seconds. Example Live Demo HTML Meta Tag Hello HTML5!

Compress Python Objects Before Saving to Cache

Rajendra Dharmkar
Updated on 30-Jul-2019 22:30:21

421 Views

We need sometimes to compress Python objects (list, dictionary, string, etc) before saving them to cache and decompress after reading from cache.Firstly we need to be sure we need to compress the objects. We should check if  the data structures/objects are too big just to fit uncompressed in the cache. There is going to be an overhead for compression/decompression, that we have to tradeoff with the gains made by caching in the first place.If we really need compression, then we probably want to use zlib.If we are going to use zlib, we might want to experiment with the different compression ... Read More

SQL Operations Supported in SAP HANA SPS06 SDA

John SAP
Updated on 30-Jul-2019 22:30:21

232 Views

With use of SAP HANA SPS06 Smart Data Access, you can only perform SELECT operation on virtual tables moved using new remote data source.

Difference between StringBuffer and StringBuilder

Akshaya Akki
Updated on 30-Jul-2019 22:30:21

1K+ Views

The StringBuffer and StringBuilder classes are used when there is a necessity to make a lot of modifications to Strings of characters.Unlike Strings, objects of type StringBuffer and String builder can be modified over and over again without leaving behind a lot of new unused objects.The StringBuilder class was introduced as of Java 5 and the main difference between the StringBuffer and StringBuilder is that StringBuilder’s methods are not thread safe (not synchronized).It is recommended to use StringBuilder whenever possible because it is faster than StringBuffer. However, if the thread safety is necessary, the best option is StringBuffer objects. Read More

SQL Operation Supported in SAP HANA SPS07 SDA

John SAP
Updated on 30-Jul-2019 22:30:21

214 Views

With use of SAP HANA SPS06 Smart Data Access, you can only perform Select, Insert, Update and Delete operation on virtual tables moved using new remote data source.

When is a Semicolon After Mandated in C++ Program

George John
Updated on 30-Jul-2019 22:30:21

3K+ Views

A semicolon after a close brace is mandatory if this is the end of a declaration. In case of braces, they have used in declarations of class, enum, struct, and initialization syntax. At the end of each of these statements, we need to put a semicolon. For example, class X {}; // same declaration for struct as well enum Y {}; int z[] = {1, 2}; A semicolon by itself is an empty statement, and you'll be able to add additional ones anywhere a statement is legal. Therefore it might be legal to place a ... Read More

NULL Argument in MySQL CONV Function

Sai Subramanyam
Updated on 30-Jul-2019 22:30:21

140 Views

MySQL will return NULL as the output if any of the argument of CONV() function is NULL or if the value provided for the base is out of limit(i.e. not between minimum 2 and maximum 36). Following examples would demonstrate it. Example mysql> Select CONV(10,NULL,2); +-----------------+ | CONV(10, NULL,2)| +-----------------+ | NULL | +-----------------+ 1 row in set (0.00 sec) mysql> Select CONV(10,10, NULL); +------------------+ | CONV(10,10, NULL)| +------------------+ | NULL | +------------------+ 1 row in set (0.00 sec) mysql> Select CONV(NULL,10,2); +-----------------+ | CONV(null,10,2) | +-----------------+ | NULL | +-----------------+ 1 row in set (0.00 sec)

Differentiating Between Row and Column Store Tables in SAP HANA Database

John SAP
Updated on 30-Jul-2019 22:30:21

729 Views

Yes, it is possible to differentiate between both the table types.  When you go to schema and view the newly created table, you can see vertical lines in front of table name and it confirms that this is column store table.In below pic, you can see the difference between a Row store table and Column store table.

Advertisements