Skip to content

Instantly share code, notes, and snippets.

View lq920320's full-sized avatar

Hunter-liu lq920320

  • Shanghai, China
View GitHub Profile
@lq920320
lq920320 / 0_reuse_code.js
Created August 14, 2017 02:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lq920320
lq920320 / ListArrayTest.java
Created July 24, 2018 03:37
List<String> to String[] by Lambda
/**
* @author liuqian
* @date 2018/7/2 17:42
*/
public class StringTest {
@Test
public void heh() {
List<Employee> employees = new ArrayList<Employee>() {{
add(new Employee() {{
setUserId("A01");
/**
* @author liuqian
* @date 2018/8/9 10:33
*/
public class StreamFilterTest {
@Test
public void listStreamFind() {
List<Integer> list = Arrays.asList(1, 10, 3, 7, 5);
Integer a = list.stream()
.filter(x -> x > 10)
// get today and clear time of day
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0); // ! clear would not reset the hour of day !
cal.clear(Calendar.MINUTE);
cal.clear(Calendar.SECOND);
cal.clear(Calendar.MILLISECOND);

// get start of this week in milliseconds
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());