Skip to content

Instantly share code, notes, and snippets.

@wyon
wyon / MultiXLCall.java
Created September 11, 2017 12:09
MultiXLCall
public class MultiXLCall<R> {
@SuppressWarnings("unchecked")
public static <T1, T2, R> MultiXLCall<R> wrap(@NonNull XLCall<T1> call1, @NonNull XLCall<T2> call2, @NonNull Zip2<T1, T2, R> zip) {
return new MultiXLCall<>(fromZip2(zip), new XLCall[]{call1, call2});
}
@SuppressWarnings("unchecked")
public static <T1, T2, T3, R> MultiXLCall<R> wrap(@NonNull XLCall<T1> call1, @NonNull XLCall<T2> call2, @NonNull XLCall<T3> call3, @NonNull Zip3<T1, T2, T3, R> zip) {
return new MultiXLCall<>(fromZip3(zip), new XLCall[]{call1, call2, call3});
@wyon
wyon / WeekParse.java
Created September 21, 2017 07:00
获取一段时间之间,所有的周
public static List<WeekBean> parseNatureWeek(long startMs, long endMs) {
if (startMs > endMs) {
return Collections.emptyList();
}
Calendar calendar = Calendar.getInstance();
// end date
calendar.setTimeInMillis(endMs);
clearTime(calendar);
endMs = calendar.getTimeInMillis();
@wyon
wyon / URLUtil.java
Last active September 21, 2017 08:02
url:String,拼接query:String
public static void main(String[] args) throws ParseException {
String query = "hello=world";
List<String> list = new ArrayList<>();
String url;
url = "http://www.baidu.com"; // no ?, no #
list.add(url); url = "http://www.baidu.com?"; // has ?, no # : just ?
list.add(url); url = "http://www.baidu.com?&"; // has ?, no # : ?&
list.add(url); url = "http://www.baidu.com?query"; // has ?, no # : ?query
list.add(url); url = "http://www.baidu.com?query&"; // has ?, no # : ?query&
list.add(url); url = "http://www.baidu.com#e"; // no ?, has # : #e