Foundation -1

Primitive data types :

byte 8-bit integer
short 16-bit integer
int 32-bit integer
long 64-bit integer
float 32-bit single precision real
double 64 bit double precision real
char 16-bit characters
boolean true or false

Analyzing object is empty:

MapUtils.isNotEmpty (map)

CollectionUtils.isNotEmpty(collection)

StringUtils.isNotEmpty(str)

Create and initialize a List:

List<Long> lst = Arrays.asList(605L,606L,607L,608L);

List<String> list = new ArrayList<String>(); 

List<String> list = Lists.newArrayList();

map traversal:

Map.Entry<String,List<T>> kvp:map.entrySet()

json array to a List:

List<T> list = JSON.parseArray(str,T.class);

Timing task frequency expression:

Correspondence is
 0 0 * * *?
Seconds, minutes, hours, days, months, days of the week
0 for a specific time, that is, 0 minutes 0 seconds
* represents every sense, that every hour a day per month
? On behalf of uncertainty

such as:

0 minutes 0 seconds per hour to perform a
<cron-expression> 0 0 * * *? </ Cron-expression>

split:

String.split () will include a head and an intermediate does not contain all of the significant digits behind the empty string. 
StringUtils.split () will filter all the empty string. Of course, the space is not filtered .

String.split ( "and | or") // more than one delimiter

Binary Search : an integer and a key orderly array of integers, return the key index in the array

    int rank(int key, int[] a) {
        int low = 0;
        int high = a.length - 1;
        while (low <= high) {
            int mid = low + (high - low) / 2;
            if (key < a[mid]) {
                high = mid - 1;
            } else if (key > a[mid]) {
                low = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    }

 

Guess you like

Origin www.cnblogs.com/csysky/p/11645647.html