); } } /span> After compiling the run-time output:oracle.jdbc.driver.OracleDrivertomtigerjdbc:oracle:thin:@192.168.1.100:1521:bjpowernodeIn the above code, first create the Attribute class object p, and then use the SetProperty () method to store the key value pair in, the value is GetProperty ("key"); (Key is the corresponding string to be stored in). When the key is the same as in HashMap, the subsequent key-value pair overrides the previous key-value pair.Finally, Treemap,
The array,list in Java has not been known before. At the same time the use of set,map,list completely confused, until the reading of this article, explained very clearly.There is no collection in the world, (only the array reference C language) but someone wants it, so there's a set of people who want to have an array that can be automatically expanded, so there's a list of people who want to have no dupl
A brief introduction to the map () functionThe map () function has always been one of the more useful functions I think, why do you say so?First, consider whether you have encountered the following scenario: You need to traverse a set of objects to fetch a property (such as an ID) of each object and separate it with a delimiterI think you must have met it! Because I've met a lot of times, this is a typical
Features of 1list:list elements! How to traverse the list collection: while-iterator traversal for-iterator traversal foreach-Iteration traversal for-get traversal (only list can be, Set,map can not) Orderly and repeatable, because the underlying implementation arrays and linked lists are subscript to indicate uniqueness, in what order, to take out or in what order.ArrayList: The underlying is an indexed array,
that all elements after the first and second elements of the collection will perform the operation of the displacement. What does all this mean?This means that you just look for elements in a particular location or only add and remove elements at the end of the collection, so you can use either a vector or a ArrayList. If this is another operation, you might want to choose a different collection operation class. For example, does the Linklist collect
Java container (list, set, map), javamapSimplified diagram of java container Class Library:
(Dotted boxes represent interfaces, while solid boxes represent common classes,
The hollow arrow indicates that a specific class implements the interface, and the solid arrow indicates that a Class Object indicated by the arrow can be generated for a class)
The main
Java Collection class is divided into three kindsSet (set): Objects in the collection are not sorted in a particular way. And there is no duplicate object, but some of the objects in the implementation class are sorted in a specific way. -Disordered, cannot repeat
list (listing): The objects in the collection are sorted
guarantee the uniqueness of the element? 73 based on whether the return value of the comparison is 74 how to guarantee the ordering of the elements? 752 Ways 76 Natural sort (elements are comparative) 77 let the class that the element belongs to implements the comparable interface 78 Comparator sort (set with comparison) 79 let the collection receive a comparator implementation class object 80 81 2. About Collection Selection principle 82 83 is the key-value object form: 84 is: The
can be thought of as a defined rule or weight.Principle: Place all the elements in the map to be sorted into a list, then use a static method of collections sort (listto arrange the list, the comparison rules are also defined by the comparator. the elements in the sorted list are then loaded into the map in order to e
void Sort_by_key () {map
From the above you can see that the key to sort is not difficult, and the placement of the sort is more troublesome, you need to turn the map.
Sort by value
Because the map in Java does not have this functionality, we need to implement it ourselves. Ideas are as follows:
The list in
List: (ordered, can be repeated) by subscript index----ArrayList variable array, randomly find----linkedlist linked list, any position insertion delete fast----Vector efficiency is lower than ArrayList, but can be used for multi-threaded synchronizationSet: (unordered, cannot be duplicated)set has a maximum of one null element because it cannot be duplicated----HashSet no sorting, no repetition(sequential random)----Linkedhashset by Insert Sort, no Duplicates(by insert order)----TreeSet implemen
required) when the Putall (map) method is called on the map.Some mapping implementations have restrictions on the keys and values that may be included. For example, some implementations prohibit null keys and values, others have restrictions on the type of their keys. Attempting to insert an unqualified key or value throws an unchecked exception, usually NullPointerException or classcastexception. Attempts
List: (ordered, can be repeated) by subscript index----ArrayList variable array, randomly finds----linkedlist linked list, no matter where the insertion is deleted fast----Vector efficiency is lower than ArrayList. But can be used for multi-threaded synchronizationSet: (unordered, cannot be repeated)set has a maximum of one null element. Since it is not possible to repeatedly----HashSet No sort, not repeatedly(sequential random)----Linkedhashset by insert sort. Do not repeat(by insert order)----
/* Each student has a corresponding place of attribution. Student student, address string. Student attributes: Name, age. Note: The same name and age are regarded as the same student. Ensure the uniqueness of students. 1, describe the student. 2, define the map container. Use the student as the key, the address as the value. Deposit. 3, gets the elements in the map collection. */import Java.util.*;class Stu
Total: Java provides a relatively complete set of container classes, the basic types are: List, set, Queue, Map, these object types are called collection classes.one, interface inheritance relationship:Iterable interface, in Java.lang package, Collection, List, Queue, set interface inherit Iterable interfaceAs can be seen, list, Queue, set these three interfaces are in the Java.util package, inherit from th
required) when the Putall (map) method is called on the map.Some mapping implementations have restrictions on the keys and values that may be included. For example, some implementations prohibit null keys and values, others have restrictions on the type of their keys. Attempting to insert an unqualified key or value throws an unchecked exception, usually NullPointerException or classcastexception. Attempts
, you can (but not require) throw an exception when you call the Putall (map) method on the map.
Some mapping implementations limit the number of keys and values that may be contained. For example, some implementations prohibit null keys and values, while others have restrictions on the type of their keys. Attempting to insert an unqualified key or value throws
JAVA/Android Map and String Conversion Method, androidmap
In Android development, Map and String conversion are often used in some requirements. Using net. sf. json. JSONObject. fromObject can easily convert string to Map. However, you need to import the jar package. In (android), resources are easily wasted. The foll
. SVG files can also embed JavaScript script to control SVG objects(3), SVG graphics format can facilitate the establishment of text indexing, so as to achieve content-based image search(4), SVG graphics format to support a variety of filters and special effects, without changing the image content of the premise of the bitmap format can be similar to the effect of text shadow(5), SVG graphics format can be used to dynamically generate graphics. For example
Lin Bingwen Evankaka original works. Reprint please specify the source Http://blog.csdn.net/evankakaAbsrtact: This paper mainly discusses the principle and process of memory mapping in Java, compares with the traditional IO, and finally, illustrates the result with an example.What is memory-mapped IO and memory-mapped files in Java? The memory-mapped file is very special, it allows the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.