interface + inheritance + code optimization idea
First share I think a very good JS programming tips, to achieve a large code sharing! Because a lot of JS Library will be in the original object on the direct prototype extension, but this is a bad
About common methods in the map collection:void Clear (); Clear MapBoolean ContainsKey (Object key); Determine if the map contains such a keyBoolean Containsvalue (Object value); Determine if the map contains such valueSet> EntrySet (); Returns a
The previous blog spoke about the basic operation of the collection interface, this blog mainly introduces the sub-interface set of the collection interface.Set is an unordered set, its basic operation and collection interface is similar, the main
First edition Example:def displaynumtype (num): Print num, "is", if Type (num) ==type (0): print ' An Interger ' elif type (num) ==type (0 L): print ' A long ' elif type (num) ==type (0.0): print ' A float ' elif type (num) ==type (0+0j): Print ' A
①= = and the essence of equals. When comparing variables with "= =" in Java, the system uses the values stored in the "stack" of variables as the basis for comparison.The base data type is stored in the stack as its content value, and the object
1.TreeSet principle:/** TreeSet can be sorted when storing objects, but it is necessary to specify an algorithm for sorting* * Integer can be sorted (with default order), string can be sorted (with default order), the custom class is stored with an
First create a student object with three attributes, int type, string type, date type Packagecom.sinoway.cisp.test;ImportJava.text.SimpleDateFormat;Importjava.util.Date; Public classStudent {Private intAge ; PrivateString name; PrivateDate birthday;
Some of the major features of TreeSet:1. The type stored in TreeSet must be consistent, cannot save int, and then save string2, TreeSet in the traversal of the collection elements, is the order of "from small to large" (my understanding, if the
question: The student number of 30 students in a class is 20070301-20070330, all of them take the Java programming course, give the results of all the students (available random number generation, range 60-100), Please write the program to the
Merge label merging tags require two or more than two lists as parameters and merge them together as follows:
If there is a value of two lists A and B, A1,a2 and B1,B2. The merge list gives the A1,B1,A2,B2.
To create
TreeSet supports two sorts of sorting methods: natural sorting and custom sorting. TreeSet default to natural sorting.
1, Natural sorting
TreeSet invokes the CompareTo (Object obj) method of the collection element to compare the size relationships
The list implementation defined in the Java Collection Framework has vector,arraylist and LinkedList. These collections provide index access to the group of objects. They provide support for adding and removing elements. However, they do not have
The data obtained from the database is generally returned in an entity manner. But to make a statement, it may be from the entity of a property to show that the so-called column inversion. So someone wrote a list of inverted SQL, and here's a Java
1 Overview
Because the project is relatively tight, there is no time to write Bowen, while the recent more leisure, hurriedly write a few to make a memo for the use, but also want to those who have just started to help it.
The use of the collection
TreeSet
Conditions
Same type
Design to sort
Comparable is natural (you can modify the case of a class)
Comparator is custom (in the case of a class cannot be modified) higher priority
Instructions for use:
Generally used is the natural sort, but
Append Tags:These append tags require two or more lists as arguments and append them together, as shown in the following illustration:
If you have a value of two lists A and B a1,a2 and B1,B2. Merging lists will give
Copy Code code as follows:
Import java.util.*;
Class Mycompare implements Comparator//implementation Comparator, define your own comparison method
{
public int Compare (object O1, Object O2) {
Elem e1= (Elem) O1;
Elem e2= (Elem) O2;
if
The pipeline is not a new thing, the previous CMD console also has redirected commands, such as Dir | More can display the results in a separate screen.The traditional cmd pipeline is text-based, but PowerShell is based on objects.
Ps> ls |
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.