id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
48,000
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Strings.java
Strings.toLines
public static List<String> toLines(final String string) throws IOException { if (null == string) { return null; } final List<String> ret = new ArrayList<>(); try (final BufferedReader bufferedReader = new BufferedReader(new StringReader(string))) { String line = ...
java
public static List<String> toLines(final String string) throws IOException { if (null == string) { return null; } final List<String> ret = new ArrayList<>(); try (final BufferedReader bufferedReader = new BufferedReader(new StringReader(string))) { String line = ...
[ "public", "static", "List", "<", "String", ">", "toLines", "(", "final", "String", "string", ")", "throws", "IOException", "{", "if", "(", "null", "==", "string", ")", "{", "return", "null", ";", "}", "final", "List", "<", "String", ">", "ret", "=", ...
Converts the specified string into a string list line by line. @param string the specified string @return a list of string lines, returns {@code null} if the specified string is {@code null} @throws IOException io exception
[ "Converts", "the", "specified", "string", "into", "a", "string", "list", "line", "by", "line", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Strings.java#L97-L113
48,001
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Strings.java
Strings.isNumeric
public static boolean isNumeric(final String string) { try { Double.parseDouble(string); } catch (final Exception e) { return false; } return true; }
java
public static boolean isNumeric(final String string) { try { Double.parseDouble(string); } catch (final Exception e) { return false; } return true; }
[ "public", "static", "boolean", "isNumeric", "(", "final", "String", "string", ")", "{", "try", "{", "Double", ".", "parseDouble", "(", "string", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "return", "false", ";", "}", "return", "t...
Checks whether the specified string is numeric. @param string the specified string @return {@code true} if the specified string is numeric, returns {@code false} otherwise
[ "Checks", "whether", "the", "specified", "string", "is", "numeric", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Strings.java#L121-L129
48,002
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Strings.java
Strings.isEmail
public static boolean isEmail(final String string) { if (StringUtils.isBlank(string)) { return false; } if (MAX_EMAIL_LENGTH < string.length()) { return false; } final String[] parts = string.split("@"); if (2 != parts.length) { retu...
java
public static boolean isEmail(final String string) { if (StringUtils.isBlank(string)) { return false; } if (MAX_EMAIL_LENGTH < string.length()) { return false; } final String[] parts = string.split("@"); if (2 != parts.length) { retu...
[ "public", "static", "boolean", "isEmail", "(", "final", "String", "string", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "string", ")", ")", "{", "return", "false", ";", "}", "if", "(", "MAX_EMAIL_LENGTH", "<", "string", ".", "length", "(", ...
Checks whether the specified string is a valid email address. @param string the specified string @return {@code true} if the specified string is a valid email address, returns {@code false} otherwise
[ "Checks", "whether", "the", "specified", "string", "is", "a", "valid", "email", "address", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Strings.java#L154-L182
48,003
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Strings.java
Strings.trimAll
public static String[] trimAll(final String[] strings) { if (null == strings) { return null; } return Arrays.stream(strings).map(StringUtils::trim).toArray(size -> new String[size]); }
java
public static String[] trimAll(final String[] strings) { if (null == strings) { return null; } return Arrays.stream(strings).map(StringUtils::trim).toArray(size -> new String[size]); }
[ "public", "static", "String", "[", "]", "trimAll", "(", "final", "String", "[", "]", "strings", ")", "{", "if", "(", "null", "==", "strings", ")", "{", "return", "null", ";", "}", "return", "Arrays", ".", "stream", "(", "strings", ")", ".", "map", ...
Trims every string in the specified strings array. @param strings the specified strings array, returns {@code null} if the specified strings is {@code null} @return a trimmed strings array
[ "Trims", "every", "string", "in", "the", "specified", "strings", "array", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Strings.java#L191-L197
48,004
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Strings.java
Strings.containsIgnoreCase
public static boolean containsIgnoreCase(final String string, final String[] strings) { if (null == strings) { return false; } return Arrays.stream(strings).anyMatch(str -> StringUtils.equalsIgnoreCase(string, str)); }
java
public static boolean containsIgnoreCase(final String string, final String[] strings) { if (null == strings) { return false; } return Arrays.stream(strings).anyMatch(str -> StringUtils.equalsIgnoreCase(string, str)); }
[ "public", "static", "boolean", "containsIgnoreCase", "(", "final", "String", "string", ",", "final", "String", "[", "]", "strings", ")", "{", "if", "(", "null", "==", "strings", ")", "{", "return", "false", ";", "}", "return", "Arrays", ".", "stream", "(...
Determines whether the specified strings contains the specified string, ignoring case considerations. @param string the specified string @param strings the specified strings @return {@code true} if the specified strings contains the specified string, ignoring case considerations, returns {@code false} otherwise
[ "Determines", "whether", "the", "specified", "strings", "contains", "the", "specified", "string", "ignoring", "case", "considerations", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Strings.java#L207-L213
48,005
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Strings.java
Strings.contains
public static boolean contains(final String string, final String[] strings) { if (null == strings) { return false; } return Arrays.stream(strings).anyMatch(str -> StringUtils.equals(string, str)); }
java
public static boolean contains(final String string, final String[] strings) { if (null == strings) { return false; } return Arrays.stream(strings).anyMatch(str -> StringUtils.equals(string, str)); }
[ "public", "static", "boolean", "contains", "(", "final", "String", "string", ",", "final", "String", "[", "]", "strings", ")", "{", "if", "(", "null", "==", "strings", ")", "{", "return", "false", ";", "}", "return", "Arrays", ".", "stream", "(", "stri...
Determines whether the specified strings contains the specified string. @param string the specified string @param strings the specified strings @return {@code true} if the specified strings contains the specified string, returns {@code false} otherwise
[ "Determines", "whether", "the", "specified", "strings", "contains", "the", "specified", "string", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Strings.java#L222-L228
48,006
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/handler/ContextHandlerMeta.java
ContextHandlerMeta.initBeforeList
private void initBeforeList() { final List<ProcessAdvice> beforeRequestProcessAdvices = new ArrayList<>(); final Method invokeHolder = getInvokeHolder(); final Class<?> processorClass = invokeHolder.getDeclaringClass(); // 1. process class advice if (null != processorClass && p...
java
private void initBeforeList() { final List<ProcessAdvice> beforeRequestProcessAdvices = new ArrayList<>(); final Method invokeHolder = getInvokeHolder(); final Class<?> processorClass = invokeHolder.getDeclaringClass(); // 1. process class advice if (null != processorClass && p...
[ "private", "void", "initBeforeList", "(", ")", "{", "final", "List", "<", "ProcessAdvice", ">", "beforeRequestProcessAdvices", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "Method", "invokeHolder", "=", "getInvokeHolder", "(", ")", ";", "final", "Cla...
Initializes before process advices.
[ "Initializes", "before", "process", "advices", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/handler/ContextHandlerMeta.java#L169-L195
48,007
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/handler/ContextHandlerMeta.java
ContextHandlerMeta.initAfterList
private void initAfterList() { final List<ProcessAdvice> afterRequestProcessAdvices = new ArrayList<>(); final Method invokeHolder = getInvokeHolder(); final Class<?> processorClass = invokeHolder.getDeclaringClass(); // 1. process method advice if (invokeHolder.isAnnotationPre...
java
private void initAfterList() { final List<ProcessAdvice> afterRequestProcessAdvices = new ArrayList<>(); final Method invokeHolder = getInvokeHolder(); final Class<?> processorClass = invokeHolder.getDeclaringClass(); // 1. process method advice if (invokeHolder.isAnnotationPre...
[ "private", "void", "initAfterList", "(", ")", "{", "final", "List", "<", "ProcessAdvice", ">", "afterRequestProcessAdvices", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "Method", "invokeHolder", "=", "getInvokeHolder", "(", ")", ";", "final", "Class...
Initializes after process advices.
[ "Initializes", "after", "process", "advices", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/handler/ContextHandlerMeta.java#L200-L226
48,008
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/Query.java
Query.select
public Query select(final String propertyName, final String... propertyNames) { projections.add(new Projection(propertyName)); if (null != propertyNames && 0 < propertyNames.length) { for (int i = 0; i < propertyNames.length; i++) { projections.add(new Projection(propertyNam...
java
public Query select(final String propertyName, final String... propertyNames) { projections.add(new Projection(propertyName)); if (null != propertyNames && 0 < propertyNames.length) { for (int i = 0; i < propertyNames.length; i++) { projections.add(new Projection(propertyNam...
[ "public", "Query", "select", "(", "final", "String", "propertyName", ",", "final", "String", "...", "propertyNames", ")", "{", "projections", ".", "add", "(", "new", "Projection", "(", "propertyName", ")", ")", ";", "if", "(", "null", "!=", "propertyNames", ...
Set SELECT projections. @param propertyName the specified property name @param propertyNames the specified other property names @return the current query object
[ "Set", "SELECT", "projections", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/Query.java#L109-L119
48,009
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/Query.java
Query.addSort
public Query addSort(final String propertyName, final SortDirection sortDirection) { sorts.put(propertyName, sortDirection); return this; }
java
public Query addSort(final String propertyName, final SortDirection sortDirection) { sorts.put(propertyName, sortDirection); return this; }
[ "public", "Query", "addSort", "(", "final", "String", "propertyName", ",", "final", "SortDirection", "sortDirection", ")", "{", "sorts", ".", "put", "(", "propertyName", ",", "sortDirection", ")", ";", "return", "this", ";", "}" ]
Adds sort for the specified property with the specified direction. @param propertyName the specified property name to sort @param sortDirection the specified sort @return the current query object
[ "Adds", "sort", "for", "the", "specified", "property", "with", "the", "specified", "direction", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/Query.java#L137-L141
48,010
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.getTimeAgo
public static String getTimeAgo(final long time, final Locale locale) { final BeanManager beanManager = BeanManager.getInstance(); final LangPropsService langService = beanManager.getReference(LangPropsService.class); final Map<String, String> langs = langService.getAll(locale); final l...
java
public static String getTimeAgo(final long time, final Locale locale) { final BeanManager beanManager = BeanManager.getInstance(); final LangPropsService langService = beanManager.getReference(LangPropsService.class); final Map<String, String> langs = langService.getAll(locale); final l...
[ "public", "static", "String", "getTimeAgo", "(", "final", "long", "time", ",", "final", "Locale", "locale", ")", "{", "final", "BeanManager", "beanManager", "=", "BeanManager", ".", "getInstance", "(", ")", ";", "final", "LangPropsService", "langService", "=", ...
Gets time ago format text. @param time the specified time. @param locale the specified locale @return time ago format text
[ "Gets", "time", "ago", "format", "text", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L72-L117
48,011
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.isSameDay
public static boolean isSameDay(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calenda...
java
public static boolean isSameDay(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calenda...
[ "public", "static", "boolean", "isSameDay", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "final", "Calendar", "cal1", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal1", ".", "setTime", "(", "date1", ")", ";", "final", ...
Determines whether the specified date1 is the same day with the specified date2. @param date1 the specified date1 @param date2 the specified date2 @return {@code true} if it is the same day, returns {@code false} otherwise
[ "Determines", "whether", "the", "specified", "date1", "is", "the", "same", "day", "with", "the", "specified", "date2", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L126-L133
48,012
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.isSameWeek
public static boolean isSameWeek(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setFirstDayOfWeek(Calendar.MONDAY); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setFirstDayOfWeek(Calendar.MONDAY); cal2....
java
public static boolean isSameWeek(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setFirstDayOfWeek(Calendar.MONDAY); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setFirstDayOfWeek(Calendar.MONDAY); cal2....
[ "public", "static", "boolean", "isSameWeek", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "final", "Calendar", "cal1", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal1", ".", "setFirstDayOfWeek", "(", "Calendar", ".", "M...
Determines whether the specified date1 is the same week with the specified date2. @param date1 the specified date1 @param date2 the specified date2 @return {@code true} if it is the same week, returns {@code false} otherwise
[ "Determines", "whether", "the", "specified", "date1", "is", "the", "same", "week", "with", "the", "specified", "date2", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L142-L154
48,013
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.isSameMonth
public static boolean isSameMonth(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) ...
java
public static boolean isSameMonth(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) ...
[ "public", "static", "boolean", "isSameMonth", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "final", "Calendar", "cal1", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal1", ".", "setTime", "(", "date1", ")", ";", "final"...
Determines whether the specified date1 is the same month with the specified date2. @param date1 the specified date1 @param date2 the specified date2 @return {@code true} if it is the same month, returns {@code false} otherwise
[ "Determines", "whether", "the", "specified", "date1", "is", "the", "same", "month", "with", "the", "specified", "date2", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L163-L173
48,014
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.getDayStartTime
public static long getDayStartTime(final long time) { final Calendar start = Calendar.getInstance(); start.setTimeInMillis(time); final int year = start.get(Calendar.YEAR); final int month = start.get(Calendar.MONTH); final int day = start.get(Calendar.DATE); start.set(ye...
java
public static long getDayStartTime(final long time) { final Calendar start = Calendar.getInstance(); start.setTimeInMillis(time); final int year = start.get(Calendar.YEAR); final int month = start.get(Calendar.MONTH); final int day = start.get(Calendar.DATE); start.set(ye...
[ "public", "static", "long", "getDayStartTime", "(", "final", "long", "time", ")", "{", "final", "Calendar", "start", "=", "Calendar", ".", "getInstance", "(", ")", ";", "start", ".", "setTimeInMillis", "(", "time", ")", ";", "final", "int", "year", "=", ...
Gets the day start time with the specified time. @param time the specified time @return day start time
[ "Gets", "the", "day", "start", "time", "with", "the", "specified", "time", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L181-L191
48,015
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.getDayEndTime
public static long getDayEndTime(final long time) { final Calendar end = Calendar.getInstance(); end.setTimeInMillis(time); final int year = end.get(Calendar.YEAR); final int month = end.get(Calendar.MONTH); final int day = end.get(Calendar.DATE); end.set(year, month, day...
java
public static long getDayEndTime(final long time) { final Calendar end = Calendar.getInstance(); end.setTimeInMillis(time); final int year = end.get(Calendar.YEAR); final int month = end.get(Calendar.MONTH); final int day = end.get(Calendar.DATE); end.set(year, month, day...
[ "public", "static", "long", "getDayEndTime", "(", "final", "long", "time", ")", "{", "final", "Calendar", "end", "=", "Calendar", ".", "getInstance", "(", ")", ";", "end", ".", "setTimeInMillis", "(", "time", ")", ";", "final", "int", "year", "=", "end",...
Gets the day end time with the specified time. @param time the specified time @return day end time
[ "Gets", "the", "day", "end", "time", "with", "the", "specified", "time", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L199-L209
48,016
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.getWeekDay
public static int getWeekDay(final long time) { final Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time); int ret = calendar.get(Calendar.DAY_OF_WEEK) - 1; if (ret <= 0) { ret = 7; } return ret; }
java
public static int getWeekDay(final long time) { final Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time); int ret = calendar.get(Calendar.DAY_OF_WEEK) - 1; if (ret <= 0) { ret = 7; } return ret; }
[ "public", "static", "int", "getWeekDay", "(", "final", "long", "time", ")", "{", "final", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "calendar", ".", "setTimeInMillis", "(", "time", ")", ";", "int", "ret", "=", "calendar", ...
Gets the week day with the specified time. @param time the specified time @return week day
[ "Gets", "the", "week", "day", "with", "the", "specified", "time", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L217-L226
48,017
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.getWeekStartTime
public static long getWeekStartTime(final long time) { final Calendar start = Calendar.getInstance(); start.setFirstDayOfWeek(Calendar.MONDAY); start.setTimeInMillis(time); start.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); start.set(Calendar.HOUR, 0); start.set(Calendar.M...
java
public static long getWeekStartTime(final long time) { final Calendar start = Calendar.getInstance(); start.setFirstDayOfWeek(Calendar.MONDAY); start.setTimeInMillis(time); start.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); start.set(Calendar.HOUR, 0); start.set(Calendar.M...
[ "public", "static", "long", "getWeekStartTime", "(", "final", "long", "time", ")", "{", "final", "Calendar", "start", "=", "Calendar", ".", "getInstance", "(", ")", ";", "start", ".", "setFirstDayOfWeek", "(", "Calendar", ".", "MONDAY", ")", ";", "start", ...
Gets the week start time with the specified time. @param time the specified time @return week start time
[ "Gets", "the", "week", "start", "time", "with", "the", "specified", "time", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L234-L245
48,018
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.getWeekEndTime
public static long getWeekEndTime(final long time) { final Calendar end = Calendar.getInstance(); end.setFirstDayOfWeek(Calendar.MONDAY); end.setTimeInMillis(time); end.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); end.set(Calendar.HOUR, 23); end.set(Calendar.MINUTE, 59); ...
java
public static long getWeekEndTime(final long time) { final Calendar end = Calendar.getInstance(); end.setFirstDayOfWeek(Calendar.MONDAY); end.setTimeInMillis(time); end.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); end.set(Calendar.HOUR, 23); end.set(Calendar.MINUTE, 59); ...
[ "public", "static", "long", "getWeekEndTime", "(", "final", "long", "time", ")", "{", "final", "Calendar", "end", "=", "Calendar", ".", "getInstance", "(", ")", ";", "end", ".", "setFirstDayOfWeek", "(", "Calendar", ".", "MONDAY", ")", ";", "end", ".", "...
Gets the week end time with the specified time. @param time the specified time @return week end time
[ "Gets", "the", "week", "end", "time", "with", "the", "specified", "time", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L253-L264
48,019
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.getMonthStartTime
public static long getMonthStartTime(final long time) { final Calendar start = Calendar.getInstance(); start.setTimeInMillis(time); final int year = start.get(Calendar.YEAR); final int month = start.get(Calendar.MONTH); start.set(year, month, 1, 0, 0, 0); start.set(Calend...
java
public static long getMonthStartTime(final long time) { final Calendar start = Calendar.getInstance(); start.setTimeInMillis(time); final int year = start.get(Calendar.YEAR); final int month = start.get(Calendar.MONTH); start.set(year, month, 1, 0, 0, 0); start.set(Calend...
[ "public", "static", "long", "getMonthStartTime", "(", "final", "long", "time", ")", "{", "final", "Calendar", "start", "=", "Calendar", ".", "getInstance", "(", ")", ";", "start", ".", "setTimeInMillis", "(", "time", ")", ";", "final", "int", "year", "=", ...
Gets the month start time with the specified time. @param time the specified time @return month start time
[ "Gets", "the", "month", "start", "time", "with", "the", "specified", "time", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L272-L281
48,020
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.getMonthEndTime
public static long getMonthEndTime(final long time) { final Calendar end = Calendar.getInstance(); end.setTimeInMillis(getDayStartTime(time)); end.set(Calendar.DAY_OF_MONTH, end.getActualMaximum(Calendar.DAY_OF_MONTH)); end.set(Calendar.HOUR, 23); end.set(Calendar.MINUTE, 59); ...
java
public static long getMonthEndTime(final long time) { final Calendar end = Calendar.getInstance(); end.setTimeInMillis(getDayStartTime(time)); end.set(Calendar.DAY_OF_MONTH, end.getActualMaximum(Calendar.DAY_OF_MONTH)); end.set(Calendar.HOUR, 23); end.set(Calendar.MINUTE, 59); ...
[ "public", "static", "long", "getMonthEndTime", "(", "final", "long", "time", ")", "{", "final", "Calendar", "end", "=", "Calendar", ".", "getInstance", "(", ")", ";", "end", ".", "setTimeInMillis", "(", "getDayStartTime", "(", "time", ")", ")", ";", "end",...
Gets the month end time with the specified time. @param time the specified time @return month end time
[ "Gets", "the", "month", "end", "time", "with", "the", "specified", "time", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L289-L299
48,021
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/CollectionUtils.java
CollectionUtils.arrayToSet
public static <T> Set<T> arrayToSet(final T[] array) { if (null == array) { return Collections.emptySet(); } final Set<T> ret = new HashSet<T>(); for (int i = 0; i < array.length; i++) { final T object = array[i]; ret.add(object); } ...
java
public static <T> Set<T> arrayToSet(final T[] array) { if (null == array) { return Collections.emptySet(); } final Set<T> ret = new HashSet<T>(); for (int i = 0; i < array.length; i++) { final T object = array[i]; ret.add(object); } ...
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "arrayToSet", "(", "final", "T", "[", "]", "array", ")", "{", "if", "(", "null", "==", "array", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "final", "Set", "<", ...
Converts the specified array to a set. @param <T> the type of elements maintained by the specified array @param array the specified array @return a hash set
[ "Converts", "the", "specified", "array", "to", "a", "set", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/CollectionUtils.java#L93-L107
48,022
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java
RouteHandler.doMatch
public static MatchResult doMatch(final String requestURI, final String httpMethod) { MatchResult ret; final int segs = StringUtils.countMatches(requestURI, "/"); ContextHandlerMeta contextHandlerMeta; String concreteKey = httpMethod + "." + requestURI; switch (segs) { ...
java
public static MatchResult doMatch(final String requestURI, final String httpMethod) { MatchResult ret; final int segs = StringUtils.countMatches(requestURI, "/"); ContextHandlerMeta contextHandlerMeta; String concreteKey = httpMethod + "." + requestURI; switch (segs) { ...
[ "public", "static", "MatchResult", "doMatch", "(", "final", "String", "requestURI", ",", "final", "String", "httpMethod", ")", "{", "MatchResult", "ret", ";", "final", "int", "segs", "=", "StringUtils", ".", "countMatches", "(", "requestURI", ",", "\"/\"", ")"...
Routes the request specified by the given request URI and HTTP method. @param requestURI the given request URI @param httpMethod the given HTTP method @return MatchResult, returns {@code null} if not found
[ "Routes", "the", "request", "specified", "by", "the", "given", "request", "URI", "and", "HTTP", "method", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java#L215-L294
48,023
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java
RouteHandler.route
private static MatchResult route(final String requestURI, final String httpMethod, final Map<String, ContextHandlerMeta> pathVarContextHandlerMetasHolder) { MatchResult ret; for (final Map.Entry<String, ContextHandlerMeta> entry : pathVarContextHandlerMetasHolder.entrySet()) { final String u...
java
private static MatchResult route(final String requestURI, final String httpMethod, final Map<String, ContextHandlerMeta> pathVarContextHandlerMetasHolder) { MatchResult ret; for (final Map.Entry<String, ContextHandlerMeta> entry : pathVarContextHandlerMetasHolder.entrySet()) { final String u...
[ "private", "static", "MatchResult", "route", "(", "final", "String", "requestURI", ",", "final", "String", "httpMethod", ",", "final", "Map", "<", "String", ",", "ContextHandlerMeta", ">", "pathVarContextHandlerMetasHolder", ")", "{", "MatchResult", "ret", ";", "f...
Routes the specified request URI containing path vars with the specified HTTP method and path var context handler metas holder. @param requestURI the specified request URI @param httpMethod the specified HTTP method @param pathVarContextHandlerMetasHolder the specified path ...
[ "Routes", "the", "specified", "request", "URI", "containing", "path", "vars", "with", "the", "specified", "HTTP", "method", "and", "path", "var", "context", "handler", "metas", "holder", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java#L441-L458
48,024
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java
RouteHandler.getHttpMethod
private String getHttpMethod(final HttpServletRequest request) { String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_METHOD); if (StringUtils.isBlank(ret)) { ret = request.getMethod(); } return ret; }
java
private String getHttpMethod(final HttpServletRequest request) { String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_METHOD); if (StringUtils.isBlank(ret)) { ret = request.getMethod(); } return ret; }
[ "private", "String", "getHttpMethod", "(", "final", "HttpServletRequest", "request", ")", "{", "String", "ret", "=", "(", "String", ")", "request", ".", "getAttribute", "(", "Keys", ".", "HttpRequest", ".", "REQUEST_METHOD", ")", ";", "if", "(", "StringUtils",...
Gets the HTTP method. @param request the specified request @return HTTP method
[ "Gets", "the", "HTTP", "method", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java#L466-L473
48,025
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java
RouteHandler.getRequestURI
private String getRequestURI(final HttpServletRequest request) { String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_URI); if (StringUtils.isBlank(ret)) { ret = request.getRequestURI(); } return ret; }
java
private String getRequestURI(final HttpServletRequest request) { String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_URI); if (StringUtils.isBlank(ret)) { ret = request.getRequestURI(); } return ret; }
[ "private", "String", "getRequestURI", "(", "final", "HttpServletRequest", "request", ")", "{", "String", "ret", "=", "(", "String", ")", "request", ".", "getAttribute", "(", "Keys", ".", "HttpRequest", ".", "REQUEST_URI", ")", ";", "if", "(", "StringUtils", ...
Gets the request URI. @param request the specified request @return requestURI
[ "Gets", "the", "request", "URI", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java#L481-L488
48,026
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java
RouteHandler.generateContextHandlerMeta
private void generateContextHandlerMeta(final Set<Bean<?>> processBeans) { for (final Bean<?> latkeBean : processBeans) { final Class<?> clz = latkeBean.getBeanClass(); final Method[] declaredMethods = clz.getDeclaredMethods(); for (int i = 0; i < declaredMethods.length; i++)...
java
private void generateContextHandlerMeta(final Set<Bean<?>> processBeans) { for (final Bean<?> latkeBean : processBeans) { final Class<?> clz = latkeBean.getBeanClass(); final Method[] declaredMethods = clz.getDeclaredMethods(); for (int i = 0; i < declaredMethods.length; i++)...
[ "private", "void", "generateContextHandlerMeta", "(", "final", "Set", "<", "Bean", "<", "?", ">", ">", "processBeans", ")", "{", "for", "(", "final", "Bean", "<", "?", ">", "latkeBean", ":", "processBeans", ")", "{", "final", "Class", "<", "?", ">", "c...
Scan beans to get the context handler meta. @param processBeans processBeans which contains {@link RequestProcessor}
[ "Scan", "beans", "to", "get", "the", "context", "handler", "meta", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/handler/RouteHandler.java#L495-L515
48,027
b3log/latke
latke-core/src/main/java/org/b3log/latke/logging/Logger.java
Logger.error
public void error(final String msg) { if (proxy.isErrorEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.ERROR_INT, msg, null, null); } else { proxy.error(msg); } ...
java
public void error(final String msg) { if (proxy.isErrorEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.ERROR_INT, msg, null, null); } else { proxy.error(msg); } ...
[ "public", "void", "error", "(", "final", "String", "msg", ")", "{", "if", "(", "proxy", ".", "isErrorEnabled", "(", ")", ")", "{", "if", "(", "proxy", "instanceof", "LocationAwareLogger", ")", "{", "(", "(", "LocationAwareLogger", ")", "proxy", ")", ".",...
Logs the specified message at the ERROR level. @param msg the specified message
[ "Logs", "the", "specified", "message", "at", "the", "ERROR", "level", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/logging/Logger.java#L78-L86
48,028
b3log/latke
latke-core/src/main/java/org/b3log/latke/logging/Logger.java
Logger.warn
public void warn(final String msg) { if (proxy.isWarnEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.WARN_INT, msg, null, null); } else { proxy.warn(msg); } } ...
java
public void warn(final String msg) { if (proxy.isWarnEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.WARN_INT, msg, null, null); } else { proxy.warn(msg); } } ...
[ "public", "void", "warn", "(", "final", "String", "msg", ")", "{", "if", "(", "proxy", ".", "isWarnEnabled", "(", ")", ")", "{", "if", "(", "proxy", "instanceof", "LocationAwareLogger", ")", "{", "(", "(", "LocationAwareLogger", ")", "proxy", ")", ".", ...
Logs the specified message at the WARN level. @param msg the specified message
[ "Logs", "the", "specified", "message", "at", "the", "WARN", "level", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/logging/Logger.java#L93-L101
48,029
b3log/latke
latke-core/src/main/java/org/b3log/latke/logging/Logger.java
Logger.info
public void info(final String msg) { if (proxy.isInfoEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.INFO_INT, msg, null, null); } else { proxy.info(msg); } } ...
java
public void info(final String msg) { if (proxy.isInfoEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.INFO_INT, msg, null, null); } else { proxy.info(msg); } } ...
[ "public", "void", "info", "(", "final", "String", "msg", ")", "{", "if", "(", "proxy", ".", "isInfoEnabled", "(", ")", ")", "{", "if", "(", "proxy", "instanceof", "LocationAwareLogger", ")", "{", "(", "(", "LocationAwareLogger", ")", "proxy", ")", ".", ...
Logs the specified message at the INFO level. @param msg the specified message
[ "Logs", "the", "specified", "message", "at", "the", "INFO", "level", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/logging/Logger.java#L108-L116
48,030
b3log/latke
latke-core/src/main/java/org/b3log/latke/logging/Logger.java
Logger.debug
public void debug(final String msg) { if (proxy.isDebugEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, null); } else { proxy.debug(msg); } ...
java
public void debug(final String msg) { if (proxy.isDebugEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, null); } else { proxy.debug(msg); } ...
[ "public", "void", "debug", "(", "final", "String", "msg", ")", "{", "if", "(", "proxy", ".", "isDebugEnabled", "(", ")", ")", "{", "if", "(", "proxy", "instanceof", "LocationAwareLogger", ")", "{", "(", "(", "LocationAwareLogger", ")", "proxy", ")", ".",...
Logs the specified message at the DEBUG level. @param msg the specified message
[ "Logs", "the", "specified", "message", "at", "the", "DEBUG", "level", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/logging/Logger.java#L123-L131
48,031
b3log/latke
latke-core/src/main/java/org/b3log/latke/logging/Logger.java
Logger.trace
public void trace(final String msg) { if (proxy.isTraceEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.TRACE_INT, msg, null, null); } else { proxy.trace(msg); } ...
java
public void trace(final String msg) { if (proxy.isTraceEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.TRACE_INT, msg, null, null); } else { proxy.trace(msg); } ...
[ "public", "void", "trace", "(", "final", "String", "msg", ")", "{", "if", "(", "proxy", ".", "isTraceEnabled", "(", ")", ")", "{", "if", "(", "proxy", "instanceof", "LocationAwareLogger", ")", "{", "(", "(", "LocationAwareLogger", ")", "proxy", ")", ".",...
Logs the specified message at the TRACE level. @param msg the specified message
[ "Logs", "the", "specified", "message", "at", "the", "TRACE", "level", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/logging/Logger.java#L138-L146
48,032
b3log/latke
latke-core/src/main/java/org/b3log/latke/logging/Logger.java
Logger.log
public void log(final Level level, final String msg, final Throwable throwable) { switch (level) { case ERROR: if (proxy.isErrorEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationA...
java
public void log(final Level level, final String msg, final Throwable throwable) { switch (level) { case ERROR: if (proxy.isErrorEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationA...
[ "public", "void", "log", "(", "final", "Level", "level", ",", "final", "String", "msg", ",", "final", "Throwable", "throwable", ")", "{", "switch", "(", "level", ")", "{", "case", "ERROR", ":", "if", "(", "proxy", ".", "isErrorEnabled", "(", ")", ")", ...
Logs the specified message with the specified logging level and throwable. @param level the specified logging level @param msg the specified message @param throwable the specified throwable
[ "Logs", "the", "specified", "message", "with", "the", "specified", "logging", "level", "and", "throwable", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/logging/Logger.java#L155-L210
48,033
b3log/latke
latke-core/src/main/java/org/b3log/latke/logging/Logger.java
Logger.log
public void log(final Level level, final String msg, final Object... args) { String message = msg; if (null != args && 0 < args.length) { // Is it a java.text style format? // Ideally we could match with Pattern.compile("\\{\\d").matcher(format).find()) // However th...
java
public void log(final Level level, final String msg, final Object... args) { String message = msg; if (null != args && 0 < args.length) { // Is it a java.text style format? // Ideally we could match with Pattern.compile("\\{\\d").matcher(format).find()) // However th...
[ "public", "void", "log", "(", "final", "Level", "level", ",", "final", "String", "msg", ",", "final", "Object", "...", "args", ")", "{", "String", "message", "=", "msg", ";", "if", "(", "null", "!=", "args", "&&", "0", "<", "args", ".", "length", "...
Logs the specified message with the specified logging level and arguments. @param level the specified logging level @param msg the specified message @param args the specified arguments
[ "Logs", "the", "specified", "message", "with", "the", "specified", "logging", "level", "and", "arguments", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/logging/Logger.java#L219-L285
48,034
b3log/latke
latke-core/src/main/java/org/b3log/latke/logging/Logger.java
Logger.isLoggable
public boolean isLoggable(final Level level) { switch (level) { case TRACE: return isTraceEnabled(); case DEBUG: return isDebugEnabled(); case INFO: return isInfoEnabled(); case WARN: return isWarnEna...
java
public boolean isLoggable(final Level level) { switch (level) { case TRACE: return isTraceEnabled(); case DEBUG: return isDebugEnabled(); case INFO: return isInfoEnabled(); case WARN: return isWarnEna...
[ "public", "boolean", "isLoggable", "(", "final", "Level", "level", ")", "{", "switch", "(", "level", ")", "{", "case", "TRACE", ":", "return", "isTraceEnabled", "(", ")", ";", "case", "DEBUG", ":", "return", "isDebugEnabled", "(", ")", ";", "case", "INFO...
Checks if a message of the given level would actually be logged by this logger. @param level the given level @return {@code true} if it could, returns {@code false} if it couldn't
[ "Checks", "if", "a", "message", "of", "the", "given", "level", "would", "actually", "be", "logged", "by", "this", "logger", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/logging/Logger.java#L358-L373
48,035
aol/cyclops
cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Observables.java
Observables.publisher
public static <T> Publisher<T> publisher(Observable<T> observable) { return observable.toFlowable(BackpressureStrategy.BUFFER); }
java
public static <T> Publisher<T> publisher(Observable<T> observable) { return observable.toFlowable(BackpressureStrategy.BUFFER); }
[ "public", "static", "<", "T", ">", "Publisher", "<", "T", ">", "publisher", "(", "Observable", "<", "T", ">", "observable", ")", "{", "return", "observable", ".", "toFlowable", "(", "BackpressureStrategy", ".", "BUFFER", ")", ";", "}" ]
Convert an Observable to a reactive-streams Publisher @param observable To convert @return reactive-streams Publisher
[ "Convert", "an", "Observable", "to", "a", "reactive", "-", "streams", "Publisher" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Observables.java#L95-L97
48,036
aol/cyclops
cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Observables.java
Observables.connectToReactiveSeq
public static <T> ReactiveSeq<T> connectToReactiveSeq(Observable<T> observable) { return Spouts.async(s->{ observable.subscribe(s::onNext,e->{ s.onError(e); s.onComplete(); },s::onComplete); }); }
java
public static <T> ReactiveSeq<T> connectToReactiveSeq(Observable<T> observable) { return Spouts.async(s->{ observable.subscribe(s::onNext,e->{ s.onError(e); s.onComplete(); },s::onComplete); }); }
[ "public", "static", "<", "T", ">", "ReactiveSeq", "<", "T", ">", "connectToReactiveSeq", "(", "Observable", "<", "T", ">", "observable", ")", "{", "return", "Spouts", ".", "async", "(", "s", "->", "{", "observable", ".", "subscribe", "(", "s", "::", "o...
Convert an Observable to a cyclops-react ReactiveSeq @param observable To conver @return ReactiveSeq
[ "Convert", "an", "Observable", "to", "a", "cyclops", "-", "react", "ReactiveSeq" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Observables.java#L105-L114
48,037
aol/cyclops
cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Observables.java
Observables.observable
public static <T> Observable<T> observable(Publisher<T> publisher) { return Flowable.fromPublisher(publisher).toObservable(); }
java
public static <T> Observable<T> observable(Publisher<T> publisher) { return Flowable.fromPublisher(publisher).toObservable(); }
[ "public", "static", "<", "T", ">", "Observable", "<", "T", ">", "observable", "(", "Publisher", "<", "T", ">", "publisher", ")", "{", "return", "Flowable", ".", "fromPublisher", "(", "publisher", ")", ".", "toObservable", "(", ")", ";", "}" ]
Convert a Publisher to an observable @param publisher To convert @return Observable
[ "Convert", "a", "Publisher", "to", "an", "observable" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Observables.java#L123-L125
48,038
aol/cyclops
cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Observables.java
Observables.anyM
public static <T> AnyMSeq<observable,T> anyM(Observable<T> obs) { return AnyM.ofSeq(ObservableReactiveSeq.reactiveSeq(obs), observable.INSTANCE); }
java
public static <T> AnyMSeq<observable,T> anyM(Observable<T> obs) { return AnyM.ofSeq(ObservableReactiveSeq.reactiveSeq(obs), observable.INSTANCE); }
[ "public", "static", "<", "T", ">", "AnyMSeq", "<", "observable", ",", "T", ">", "anyM", "(", "Observable", "<", "T", ">", "obs", ")", "{", "return", "AnyM", ".", "ofSeq", "(", "ObservableReactiveSeq", ".", "reactiveSeq", "(", "obs", ")", ",", "observab...
Construct an AnyM type from an Observable. This allows the Observable to be manipulated according to a standard interface along with a vast array of other Java Monad implementations <pre> {@code AnyMSeq<Integer> obs = Observables.anyM(Observable.just(1,2,3)); AnyMSeq<Integer> transformedObs = myGenericOperation(obs);...
[ "Construct", "an", "AnyM", "type", "from", "an", "Observable", ".", "This", "allows", "the", "Observable", "to", "be", "manipulated", "according", "to", "a", "standard", "interface", "along", "with", "a", "vast", "array", "of", "other", "Java", "Monad", "imp...
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Observables.java#L152-L154
48,039
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/box/MutableChar.java
MutableChar.fromExternal
public static MutableChar fromExternal(final Supplier<Character> s, final Consumer<Character> c) { return new MutableChar() { @Override public char getAsChar() { return s.get(); } @Override public Character get() { retu...
java
public static MutableChar fromExternal(final Supplier<Character> s, final Consumer<Character> c) { return new MutableChar() { @Override public char getAsChar() { return s.get(); } @Override public Character get() { retu...
[ "public", "static", "MutableChar", "fromExternal", "(", "final", "Supplier", "<", "Character", ">", "s", ",", "final", "Consumer", "<", "Character", ">", "c", ")", "{", "return", "new", "MutableChar", "(", ")", "{", "@", "Override", "public", "char", "getA...
Construct a MutableChar that gets and sets an external value using the provided Supplier and Consumer e.g. <pre> {@code MutableChar mutable = MutableChar.fromExternal(()->!this.value,val->!this.value); } </pre> @param s Supplier of an external value @param c Consumer that sets an external value @return MutableChar t...
[ "Construct", "a", "MutableChar", "that", "gets", "and", "sets", "an", "external", "value", "using", "the", "provided", "Supplier", "and", "Consumer" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableChar.java#L81-L99
48,040
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/box/MutableDouble.java
MutableDouble.fromExternal
public static MutableDouble fromExternal(final DoubleSupplier s, final DoubleConsumer c) { return new MutableDouble() { @Override public double getAsDouble() { return s.getAsDouble(); } @Override public Double get() { r...
java
public static MutableDouble fromExternal(final DoubleSupplier s, final DoubleConsumer c) { return new MutableDouble() { @Override public double getAsDouble() { return s.getAsDouble(); } @Override public Double get() { r...
[ "public", "static", "MutableDouble", "fromExternal", "(", "final", "DoubleSupplier", "s", ",", "final", "DoubleConsumer", "c", ")", "{", "return", "new", "MutableDouble", "(", ")", "{", "@", "Override", "public", "double", "getAsDouble", "(", ")", "{", "return...
Construct a MutableDouble that gets and sets an external value using the provided Supplier and Consumer e.g. <pre> {@code MutableDouble mutable = MutableDouble.fromExternal(()->!this.value,val->!this.value); } </pre> @param s Supplier of an external value @param c Consumer that sets an external value @return Mutable...
[ "Construct", "a", "MutableDouble", "that", "gets", "and", "sets", "an", "external", "value", "using", "the", "provided", "Supplier", "and", "Consumer" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableDouble.java#L81-L99
48,041
aol/cyclops
cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Maybes.java
Maybes.combine
public static <T1, T2, R> Maybe<R> combine(Maybe<? extends T1> maybe, Maybe<? extends T2> app, BiFunction<? super T1, ? super T2, ? extends R> fn) { return narrow(Single.fromPublisher(Future.fromPublisher(maybe.toFlowable()) .zip(Future.fromPublisher(app.toFlowable())...
java
public static <T1, T2, R> Maybe<R> combine(Maybe<? extends T1> maybe, Maybe<? extends T2> app, BiFunction<? super T1, ? super T2, ? extends R> fn) { return narrow(Single.fromPublisher(Future.fromPublisher(maybe.toFlowable()) .zip(Future.fromPublisher(app.toFlowable())...
[ "public", "static", "<", "T1", ",", "T2", ",", "R", ">", "Maybe", "<", "R", ">", "combine", "(", "Maybe", "<", "?", "extends", "T1", ">", "maybe", ",", "Maybe", "<", "?", "extends", "T2", ">", "app", ",", "BiFunction", "<", "?", "super", "T1", ...
Lazily combine this Maybe with the supplied Maybe via the supplied BiFunction @param maybe Maybe to combine with another value @param app Maybe to combine with supplied maybe @param fn Combiner function @return Combined Maybe
[ "Lazily", "combine", "this", "Maybe", "with", "the", "supplied", "Maybe", "via", "the", "supplied", "BiFunction" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Maybes.java#L357-L361
48,042
aol/cyclops
cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Maybes.java
Maybes.fromIterable
public static <T> Maybe<T> fromIterable(Iterable<T> t) { return narrow(Single.fromPublisher(Future.fromIterable(t)).toMaybe()); }
java
public static <T> Maybe<T> fromIterable(Iterable<T> t) { return narrow(Single.fromPublisher(Future.fromIterable(t)).toMaybe()); }
[ "public", "static", "<", "T", ">", "Maybe", "<", "T", ">", "fromIterable", "(", "Iterable", "<", "T", ">", "t", ")", "{", "return", "narrow", "(", "Single", ".", "fromPublisher", "(", "Future", ".", "fromIterable", "(", "t", ")", ")", ".", "toMaybe",...
Construct a Maybe from Iterable by taking the first value from Iterable @param t Iterable to populate Maybe from @return Maybe containing first element from Iterable (or empty Maybe)
[ "Construct", "a", "Maybe", "from", "Iterable", "by", "taking", "the", "first", "value", "from", "Iterable" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Maybes.java#L398-L400
48,043
aol/cyclops
cyclops-pure/src/main/java/cyclops/control/Writer.java
Writer.forEach3
public <R1, R2, R4> Writer<W,R4> forEach3(Function<? super T, ? extends Writer<W,R1>> value2, BiFunction<? super T, ? super R1, ? extends Writer<W,R2>> value3, Function3<? super T, ? super R1, ? super R2, ? extends R4> yieldin...
java
public <R1, R2, R4> Writer<W,R4> forEach3(Function<? super T, ? extends Writer<W,R1>> value2, BiFunction<? super T, ? super R1, ? extends Writer<W,R2>> value3, Function3<? super T, ? super R1, ? super R2, ? extends R4> yieldin...
[ "public", "<", "R1", ",", "R2", ",", "R4", ">", "Writer", "<", "W", ",", "R4", ">", "forEach3", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "Writer", "<", "W", ",", "R1", ">", ">", "value2", ",", "BiFunction", "<", "?", "super...
Perform a For Comprehension over a Writer, accepting 2 generating function. This results in a three level nested internal iteration over the provided Writers. <pre> {@code import static com.oath.cyclops.reactor.Writers.forEach3; forEach3(Writer.just(1), a-> Writer.just(a+1), (a,b) -> Writer.<Integer>just(a+b), Tuple...
[ "Perform", "a", "For", "Comprehension", "over", "a", "Writer", "accepting", "2", "generating", "function", ".", "This", "results", "in", "a", "three", "level", "nested", "internal", "iteration", "over", "the", "provided", "Writers", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/control/Writer.java#L131-L151
48,044
aol/cyclops
cyclops-pure/src/main/java/cyclops/control/Writer.java
Writer.forEach2
public <R1, R4> Writer<W,R4> forEach2(Function<? super T, Writer<W,R1>> value2, BiFunction<? super T, ? super R1, ? extends R4> yieldingFunction) { return this.flatMap(in -> { Writer<W,R1> a = value2.apply(in); return a.map(in2 -> { ...
java
public <R1, R4> Writer<W,R4> forEach2(Function<? super T, Writer<W,R1>> value2, BiFunction<? super T, ? super R1, ? extends R4> yieldingFunction) { return this.flatMap(in -> { Writer<W,R1> a = value2.apply(in); return a.map(in2 -> { ...
[ "public", "<", "R1", ",", "R4", ">", "Writer", "<", "W", ",", "R4", ">", "forEach2", "(", "Function", "<", "?", "super", "T", ",", "Writer", "<", "W", ",", "R1", ">", ">", "value2", ",", "BiFunction", "<", "?", "super", "T", ",", "?", "super", ...
Perform a For Comprehension over a Writer, accepting a generating function. This results in a two level nested internal iteration over the provided Writers. <pre> {@code import static com.oath.cyclops.reactor.Writers.forEach; forEach(Writer.just(1), a-> Writer.just(a+1), Tuple::tuple) } </pre> @param value2 Nested...
[ "Perform", "a", "For", "Comprehension", "over", "a", "Writer", "accepting", "a", "generating", "function", ".", "This", "results", "in", "a", "two", "level", "nested", "internal", "iteration", "over", "the", "provided", "Writers", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/control/Writer.java#L174-L187
48,045
aol/cyclops
cyclops/src/main/java/cyclops/function/FluentFunctions.java
FluentFunctions.of
public static <R> FluentFunctions.FluentSupplier<R> of(final Supplier<R> supplier) { return new FluentSupplier<>( supplier); }
java
public static <R> FluentFunctions.FluentSupplier<R> of(final Supplier<R> supplier) { return new FluentSupplier<>( supplier); }
[ "public", "static", "<", "R", ">", "FluentFunctions", ".", "FluentSupplier", "<", "R", ">", "of", "(", "final", "Supplier", "<", "R", ">", "supplier", ")", "{", "return", "new", "FluentSupplier", "<>", "(", "supplier", ")", ";", "}" ]
Construct a FluentSupplier from a Supplier <pre> {@code Cache<Object, Integer> cache = CacheBuilder.newBuilder() .maximumSize(1000) .expireAfterWrite(10, TimeUnit.MINUTES) .build(); called=0; Supplier<Integer> fn = FluentFunctions.of(this::getOne) .name("myFunction") .memoize((key,f)->cache.getValue(key,()->f.applyHK...
[ "Construct", "a", "FluentSupplier", "from", "a", "Supplier" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/FluentFunctions.java#L86-L89
48,046
aol/cyclops
cyclops/src/main/java/cyclops/function/FluentFunctions.java
FluentFunctions.ofChecked
public static <T, R> FluentFunctions.FluentFunction<T, R> ofChecked(final CheckedFunction<T, R> fn) { return FluentFunctions.of(ExceptionSoftener.softenFunction(fn)); }
java
public static <T, R> FluentFunctions.FluentFunction<T, R> ofChecked(final CheckedFunction<T, R> fn) { return FluentFunctions.of(ExceptionSoftener.softenFunction(fn)); }
[ "public", "static", "<", "T", ",", "R", ">", "FluentFunctions", ".", "FluentFunction", "<", "T", ",", "R", ">", "ofChecked", "(", "final", "CheckedFunction", "<", "T", ",", "R", ">", "fn", ")", "{", "return", "FluentFunctions", ".", "of", "(", "Excepti...
Construct a FluentFunction from a CheckedFunction <pre> {@code FluentFunctions.ofChecked(this::exceptionalFirstTime) .recover(IOException.class, in->in+"boo!") .println() .applyHKT("hello ") } </pre> @param fn CheckedFunction @return FluentFunction
[ "Construct", "a", "FluentFunction", "from", "a", "CheckedFunction" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/FluentFunctions.java#L110-L112
48,047
aol/cyclops
cyclops/src/main/java/cyclops/function/FluentFunctions.java
FluentFunctions.of
public static <T, R> FluentFunctions.FluentFunction<T, R> of(final Function<T, R> fn) { return new FluentFunction<>( fn); }
java
public static <T, R> FluentFunctions.FluentFunction<T, R> of(final Function<T, R> fn) { return new FluentFunction<>( fn); }
[ "public", "static", "<", "T", ",", "R", ">", "FluentFunctions", ".", "FluentFunction", "<", "T", ",", "R", ">", "of", "(", "final", "Function", "<", "T", ",", "R", ">", "fn", ")", "{", "return", "new", "FluentFunction", "<>", "(", "fn", ")", ";", ...
Construct a FluentFunction from a Function <pre> {@code FluentFunctions.of(this::addOne) .around(advice->advice.proceed(advice.param+1)) .println() .applyHKT(10) } </pre> @param fn Function @return FluentFunction
[ "Construct", "a", "FluentFunction", "from", "a", "Function" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/FluentFunctions.java#L128-L131
48,048
aol/cyclops
cyclops/src/main/java/cyclops/function/FluentFunctions.java
FluentFunctions.ofChecked
public static <T1, T2, R> FluentFunctions.FluentBiFunction<T1, T2, R> ofChecked(final CheckedBiFunction<T1, T2, R> fn) { return FluentFunctions.of(ExceptionSoftener.softenBiFunction(fn)); }
java
public static <T1, T2, R> FluentFunctions.FluentBiFunction<T1, T2, R> ofChecked(final CheckedBiFunction<T1, T2, R> fn) { return FluentFunctions.of(ExceptionSoftener.softenBiFunction(fn)); }
[ "public", "static", "<", "T1", ",", "T2", ",", "R", ">", "FluentFunctions", ".", "FluentBiFunction", "<", "T1", ",", "T2", ",", "R", ">", "ofChecked", "(", "final", "CheckedBiFunction", "<", "T1", ",", "T2", ",", "R", ">", "fn", ")", "{", "return", ...
Construct a FluentBiFunction from a CheckedBiFunction <pre> {@code FluentFunctions.ofChecked(this::exceptionalFirstTime) .println() .retry(2,500) .applyHKT("hello","woo!") } </pre> @param fn CheckedBiFunction @return FluentBiFunction
[ "Construct", "a", "FluentBiFunction", "from", "a", "CheckedBiFunction" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/FluentFunctions.java#L147-L149
48,049
aol/cyclops
cyclops/src/main/java/cyclops/function/FluentFunctions.java
FluentFunctions.checkedExpression
public static <T1, T2> FluentFunctions.FluentBiFunction<T1, T2, Tuple2<T1, T2>> checkedExpression(final CheckedBiConsumer<T1, T2> action) { final BiConsumer<T1, T2> toUse = ExceptionSoftener.softenBiConsumer(action); return FluentFunctions.of((t1, t2) -> { toUse.accept(t1, t2); r...
java
public static <T1, T2> FluentFunctions.FluentBiFunction<T1, T2, Tuple2<T1, T2>> checkedExpression(final CheckedBiConsumer<T1, T2> action) { final BiConsumer<T1, T2> toUse = ExceptionSoftener.softenBiConsumer(action); return FluentFunctions.of((t1, t2) -> { toUse.accept(t1, t2); r...
[ "public", "static", "<", "T1", ",", "T2", ">", "FluentFunctions", ".", "FluentBiFunction", "<", "T1", ",", "T2", ",", "Tuple2", "<", "T1", ",", "T2", ">", ">", "checkedExpression", "(", "final", "CheckedBiConsumer", "<", "T1", ",", "T2", ">", "action", ...
Convert a CheckedBiConsumer into a FluentBiConsumer that returns it's input in a tuple <pre> {@code public void printTwo(String input1,String input2) throws IOException{ System.out.println(input1); System.out.println(input2); } FluentFunctions.checkedExpression(this::printTwo) .applyHKT("hello","world"); returns Tup...
[ "Convert", "a", "CheckedBiConsumer", "into", "a", "FluentBiConsumer", "that", "returns", "it", "s", "input", "in", "a", "tuple" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/FluentFunctions.java#L292-L298
48,050
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/stream/scheduling/cron/CronExpression.java
CronExpression.isSatisfiedBy
public boolean isSatisfiedBy(final Date date) { final Calendar testDateCal = Calendar.getInstance(getTimeZone()); testDateCal.setTime(date); testDateCal.set(Calendar.MILLISECOND, 0); final Date originalDate = testDateCal.getTime(); testDateCal.add(Calendar.SECOND, -1); ...
java
public boolean isSatisfiedBy(final Date date) { final Calendar testDateCal = Calendar.getInstance(getTimeZone()); testDateCal.setTime(date); testDateCal.set(Calendar.MILLISECOND, 0); final Date originalDate = testDateCal.getTime(); testDateCal.add(Calendar.SECOND, -1); ...
[ "public", "boolean", "isSatisfiedBy", "(", "final", "Date", "date", ")", "{", "final", "Calendar", "testDateCal", "=", "Calendar", ".", "getInstance", "(", "getTimeZone", "(", ")", ")", ";", "testDateCal", ".", "setTime", "(", "date", ")", ";", "testDateCal"...
Indicates whether the given date satisfies the cron expression. Note that milliseconds are ignored, so two Dates falling on different milliseconds of the same second will always have the same result here. @param date the date to evaluate @return a boolean indicating whether the given date satisfies the cron expression
[ "Indicates", "whether", "the", "given", "date", "satisfies", "the", "cron", "expression", ".", "Note", "that", "milliseconds", "are", "ignored", "so", "two", "Dates", "falling", "on", "different", "milliseconds", "of", "the", "same", "second", "will", "always", ...
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/stream/scheduling/cron/CronExpression.java#L320-L331
48,051
aol/cyclops
cyclops-pure/src/main/java/cyclops/typeclasses/functor/Compose.java
Compose.compose
public static <CRE,C2> Compose<CRE,C2> compose(Functor<CRE> f,Functor<C2> g){ return new Compose<>(f,g); }
java
public static <CRE,C2> Compose<CRE,C2> compose(Functor<CRE> f,Functor<C2> g){ return new Compose<>(f,g); }
[ "public", "static", "<", "CRE", ",", "C2", ">", "Compose", "<", "CRE", ",", "C2", ">", "compose", "(", "Functor", "<", "CRE", ">", "f", ",", "Functor", "<", "C2", ">", "g", ")", "{", "return", "new", "Compose", "<>", "(", "f", ",", "g", ")", ...
Compose two functors @param f First functor to compose @param g Second functor to compose @return Composed functor
[ "Compose", "two", "functors" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/typeclasses/functor/Compose.java#L50-L52
48,052
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.forEach4
public static <T1, T2, T3, R1, R2, R3, R> Stream<R> forEach4(Stream<? extends T1> value1, Function<? super T1, ? extends Stream<R1>> value2, BiFunction<? super T1, ? super R1, ? extends Stre...
java
public static <T1, T2, T3, R1, R2, R3, R> Stream<R> forEach4(Stream<? extends T1> value1, Function<? super T1, ? extends Stream<R1>> value2, BiFunction<? super T1, ? super R1, ? extends Stre...
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "R1", ",", "R2", ",", "R3", ",", "R", ">", "Stream", "<", "R", ">", "forEach4", "(", "Stream", "<", "?", "extends", "T1", ">", "value1", ",", "Function", "<", "?", "super", "T1", ",", ...
Perform a For Comprehension over a Stream, accepting 3 generating arrow. This results in a four level nested internal iteration over the provided Publishers. <pre> {@code import static cyclops.companion.Streams.forEach4; forEach4(IntStream.range(1,10).boxed(), a-> Stream.iterate(a,i->i+1).limit(10), (a,b) -> Stream....
[ "Perform", "a", "For", "Comprehension", "over", "a", "Stream", "accepting", "3", "generating", "arrow", ".", "This", "results", "in", "a", "four", "level", "nested", "internal", "iteration", "over", "the", "provided", "Publishers", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L211-L232
48,053
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.streamToOptional
public final static <T> Optional<Seq<T>> streamToOptional(final Stream<T> stream) { final List<T> collected = stream.collect(java.util.stream.Collectors.toList()); if (collected.size() == 0) return Optional.empty(); return Optional.of(Seq.fromIterable(collected)); }
java
public final static <T> Optional<Seq<T>> streamToOptional(final Stream<T> stream) { final List<T> collected = stream.collect(java.util.stream.Collectors.toList()); if (collected.size() == 0) return Optional.empty(); return Optional.of(Seq.fromIterable(collected)); }
[ "public", "final", "static", "<", "T", ">", "Optional", "<", "Seq", "<", "T", ">", ">", "streamToOptional", "(", "final", "Stream", "<", "T", ">", "stream", ")", "{", "final", "List", "<", "T", ">", "collected", "=", "stream", ".", "collect", "(", ...
Create an Optional containing a List materialized from a Stream <pre> {@code Optional<Seq<Integer>> opt = Streams.streamToOptional(Stream.of(1,2,3)); //Optional[[1,2,3]] } </pre> @param stream To convert into an Optional @return Optional with a List of values
[ "Create", "an", "Optional", "containing", "a", "List", "materialized", "from", "a", "Stream" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L473-L479
48,054
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.optionalToStream
public final static <T> Stream<T> optionalToStream(final Optional<T> optional) { if (optional.isPresent()) return Stream.of(optional.get()); return Stream.of(); }
java
public final static <T> Stream<T> optionalToStream(final Optional<T> optional) { if (optional.isPresent()) return Stream.of(optional.get()); return Stream.of(); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "T", ">", "optionalToStream", "(", "final", "Optional", "<", "T", ">", "optional", ")", "{", "if", "(", "optional", ".", "isPresent", "(", ")", ")", "return", "Stream", ".", "of", "(", "optio...
Convert an Optional to a Stream <pre> {@code Stream<Integer> stream = Streams.optionalToStream(Optional.of(1)); //Stream[1] Stream<Integer> zero = Streams.optionalToStream(Optional.zero()); //Stream[] } </pre> @param optional Optional to convert to a Stream @return Stream with a single value (if present) created fro...
[ "Convert", "an", "Optional", "to", "a", "Stream" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L497-L501
48,055
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.streamToCompletableFuture
public final static <T> CompletableFuture<List<T>> streamToCompletableFuture(final Stream<T> stream) { return CompletableFuture.completedFuture(stream.collect(Collectors.toList())); }
java
public final static <T> CompletableFuture<List<T>> streamToCompletableFuture(final Stream<T> stream) { return CompletableFuture.completedFuture(stream.collect(Collectors.toList())); }
[ "public", "final", "static", "<", "T", ">", "CompletableFuture", "<", "List", "<", "T", ">", ">", "streamToCompletableFuture", "(", "final", "Stream", "<", "T", ">", "stream", ")", "{", "return", "CompletableFuture", ".", "completedFuture", "(", "stream", "....
Create a CompletableFuture containing a List materialized from a Stream @param stream To convert into an Optional @return CompletableFuture with a List of values
[ "Create", "a", "CompletableFuture", "containing", "a", "List", "materialized", "from", "a", "Stream" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L509-L512
48,056
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.completableFutureToStream
public final static <T> Stream<T> completableFutureToStream(final CompletableFuture<T> future) { return Stream.of(future.join()); }
java
public final static <T> Stream<T> completableFutureToStream(final CompletableFuture<T> future) { return Stream.of(future.join()); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "T", ">", "completableFutureToStream", "(", "final", "CompletableFuture", "<", "T", ">", "future", ")", "{", "return", "Stream", ".", "of", "(", "future", ".", "join", "(", ")", ")", ";", "}" ]
Convert a CompletableFuture to a Stream @param future CompletableFuture to convert @return Stream with a single value created from a CompletableFuture
[ "Convert", "a", "CompletableFuture", "to", "a", "Stream" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L520-L523
48,057
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.quadruplicate
@SuppressWarnings("unchecked") public final static <T> Tuple4<Stream<T>, Stream<T>, Stream<T>, Stream<T>> quadruplicate(final Stream<T> stream) { final Stream<Stream<T>> its = Streams.toBufferingCopier(stream.iterator(), 4) .stream() ...
java
@SuppressWarnings("unchecked") public final static <T> Tuple4<Stream<T>, Stream<T>, Stream<T>, Stream<T>> quadruplicate(final Stream<T> stream) { final Stream<Stream<T>> its = Streams.toBufferingCopier(stream.iterator(), 4) .stream() ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "static", "<", "T", ">", "Tuple4", "<", "Stream", "<", "T", ">", ",", "Stream", "<", "T", ">", ",", "Stream", "<", "T", ">", ",", "Stream", "<", "T", ">", ">", "quadruplicate", ...
Makes four copies of a Stream Buffers intermediate values, leaders may change positions so a limit can be safely applied to the leading stream. Not thread-safe. <pre> {@code Tuple4<ReactiveSeq<Tuple4<T1,T2,T3,T4>>,ReactiveSeq<Tuple4<T1,T2,T3,T4>>,ReactiveSeq<Tuple4<T1,T2,T3,T4>>,ReactiveSeq<Tuple4<T1,T2,T3,T4>>> quad...
[ "Makes", "four", "copies", "of", "a", "Stream", "Buffers", "intermediate", "values", "leaders", "may", "change", "positions", "so", "a", "limit", "can", "be", "safely", "applied", "to", "the", "leading", "stream", ".", "Not", "thread", "-", "safe", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L973-L981
48,058
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.appendStream
public static final <T> Stream<T> appendStream(final Stream<T> stream1, final Stream<T> append) { return Stream.concat(stream1, append); }
java
public static final <T> Stream<T> appendStream(final Stream<T> stream1, final Stream<T> append) { return Stream.concat(stream1, append); }
[ "public", "static", "final", "<", "T", ">", "Stream", "<", "T", ">", "appendStream", "(", "final", "Stream", "<", "T", ">", "stream1", ",", "final", "Stream", "<", "T", ">", "append", ")", "{", "return", "Stream", ".", "concat", "(", "stream1", ",", ...
Append Stream to this Stream <pre> {@code List<String> result = of(1,2,3).appendStream(of(100,200,300)) .map(it ->it+"!!") .collect(CyclopsCollectors.toList()); assertThat(result,equalTo(Arrays.asList("1!!","2!!","3!!","100!!","200!!","300!!"))); } </pre> @param stream1 to append to @param append to append with @re...
[ "Append", "Stream", "to", "this", "Stream" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1023-L1025
48,059
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.prependStream
public static final <T> Stream<T> prependStream(final Stream<T> stream1, final Stream<T> prepend) { return Stream.concat(prepend, stream1); }
java
public static final <T> Stream<T> prependStream(final Stream<T> stream1, final Stream<T> prepend) { return Stream.concat(prepend, stream1); }
[ "public", "static", "final", "<", "T", ">", "Stream", "<", "T", ">", "prependStream", "(", "final", "Stream", "<", "T", ">", "stream1", ",", "final", "Stream", "<", "T", ">", "prepend", ")", "{", "return", "Stream", ".", "concat", "(", "prepend", ","...
Prepend Stream to this Stream <pre> {@code List<String> result = of(1,2,3).prependStream(of(100,200,300)) .map(it ->it+"!!").collect(CyclopsCollectors.toList()); assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!"))); } </pre> @param stream1 to Prepend to @param prepend to Prepend with...
[ "Prepend", "Stream", "to", "this", "Stream" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1044-L1047
48,060
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.dropWhile
public static <U> Stream<U> dropWhile(final Stream<U> stream, final Predicate<? super U> predicate) { return StreamSupport.stream(new SkipWhileSpliterator<U>(stream.spliterator(),predicate), stream.isParallel()); }
java
public static <U> Stream<U> dropWhile(final Stream<U> stream, final Predicate<? super U> predicate) { return StreamSupport.stream(new SkipWhileSpliterator<U>(stream.spliterator(),predicate), stream.isParallel()); }
[ "public", "static", "<", "U", ">", "Stream", "<", "U", ">", "dropWhile", "(", "final", "Stream", "<", "U", ">", "stream", ",", "final", "Predicate", "<", "?", "super", "U", ">", "predicate", ")", "{", "return", "StreamSupport", ".", "stream", "(", "n...
skip elements in a Stream while Predicate holds true <pre> {@code Streams.dropWhile(Stream.of(4,3,6,7).sorted(),i->i<6).collect(CyclopsCollectors.toList()) // [6,7] }</pre> @param stream @param predicate @return
[ "skip", "elements", "in", "a", "Stream", "while", "Predicate", "holds", "true" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1192-L1194
48,061
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.cycle
public static <U> Stream<U> cycle(final Stream<U> s) { return cycle(Streamable.fromStream(s)); }
java
public static <U> Stream<U> cycle(final Stream<U> s) { return cycle(Streamable.fromStream(s)); }
[ "public", "static", "<", "U", ">", "Stream", "<", "U", ">", "cycle", "(", "final", "Stream", "<", "U", ">", "s", ")", "{", "return", "cycle", "(", "Streamable", ".", "fromStream", "(", "s", ")", ")", ";", "}" ]
Create a new Stream that infiniteable cycles the provided Stream <pre> {@code assertThat(Streams.cycle(Stream.of(1,2,3)) .limit(6) .collect(CyclopsCollectors.toList()), equalTo(Arrays.asList(1,2,3,1,2,3))); } </pre> @param s Stream to cycle @return New cycling stream
[ "Create", "a", "new", "Stream", "that", "infiniteable", "cycles", "the", "provided", "Stream" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1367-L1369
48,062
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.reduce
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <R> Seq<R> reduce(final Stream<R> stream, final Iterable<? extends Monoid<R>> reducers) { return Seq.fromIterable(new MultiReduceOperator<R>( stream).reduce(reducers)); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <R> Seq<R> reduce(final Stream<R> stream, final Iterable<? extends Monoid<R>> reducers) { return Seq.fromIterable(new MultiReduceOperator<R>( stream).reduce(reducers)); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "<", "R", ">", "Seq", "<", "R", ">", "reduce", "(", "final", "Stream", "<", "R", ">", "stream", ",", "final", "Iterable", "<", "?", "extends", "Monoi...
Simultaneously reduce a stream with multiple reducers <pre>{@code Monoid<Integer> sum = Monoid.of(0,(a,b)->a+b); Monoid<Integer> mult = Monoid.of(1,(a,b)->a*b); val result = Streams.reduce(Stream.of(1,2,3,4),Arrays.asList(sum,mult)); assertThat(result,equalTo(Arrays.asList(10,24))); }</pre> @param stream Stream to...
[ "Simultaneously", "reduce", "a", "stream", "with", "multiple", "reducers" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1507-L1512
48,063
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.reduce
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <R> Seq<R> reduce(final Stream<R> stream, final Stream<? extends Monoid<R>> reducers) { return reduce(stream, Seq.fromIterable((List) reducers.collect(java.util.stream.Collectors.toList()))); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <R> Seq<R> reduce(final Stream<R> stream, final Stream<? extends Monoid<R>> reducers) { return reduce(stream, Seq.fromIterable((List) reducers.collect(java.util.stream.Collectors.toList()))); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "<", "R", ">", "Seq", "<", "R", ">", "reduce", "(", "final", "Stream", "<", "R", ">", "stream", ",", "final", "Stream", "<", "?", "extends", "Monoid"...
Simultanously reduce a stream with multiple reducers <pre> {@code Monoid<String> concat = Monoid.of("",(a,b)->a+b); Monoid<String> join = Monoid.of("",(a,b)->a+","+b); assertThat(Streams.reduce(Stream.of("hello", "world", "woo!"),Stream.of(concat,join)) ,equalTo(Arrays.asList("helloworldwoo!",",hello,world,woo!"))); }...
[ "Simultanously", "reduce", "a", "stream", "with", "multiple", "reducers" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1530-L1534
48,064
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.cycleUntil
public final static <T> Stream<T> cycleUntil(final Stream<T> stream, final Predicate<? super T> predicate) { return Streams.takeUntil(Streams.cycle(stream), predicate); }
java
public final static <T> Stream<T> cycleUntil(final Stream<T> stream, final Predicate<? super T> predicate) { return Streams.takeUntil(Streams.cycle(stream), predicate); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "T", ">", "cycleUntil", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "return", "Streams", ".", "takeUntil", ...
Repeat in a Stream until specified predicate holds <pre> {@code count =0; assertThat(Streams.cycleUntil(Stream.of(1,2,2,3) ,next -> count++>10 ) .collect(CyclopsCollectors.toList()),equalTo(Arrays.asList(1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2))); } </pre> @param predicate repeat while true @return Repeating Stream
[ "Repeat", "in", "a", "Stream", "until", "specified", "predicate", "holds" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1571-L1573
48,065
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.zipSequence
public final static <T, S, R> Stream<R> zipSequence(final Stream<T> stream, final Stream<? extends S> second, final BiFunction<? super T, ? super S, ? extends R> zipper) { final Iterator<T> left = stream.iterator(); final Iterator<? extends S> right = second.iterator(); return Stream...
java
public final static <T, S, R> Stream<R> zipSequence(final Stream<T> stream, final Stream<? extends S> second, final BiFunction<? super T, ? super S, ? extends R> zipper) { final Iterator<T> left = stream.iterator(); final Iterator<? extends S> right = second.iterator(); return Stream...
[ "public", "final", "static", "<", "T", ",", "S", ",", "R", ">", "Stream", "<", "R", ">", "zipSequence", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Stream", "<", "?", "extends", "S", ">", "second", ",", "final", "BiFunction", "<...
Generic zip function. E.g. Zipping a Stream and a Sequence <pre> {@code Stream<List<Integer>> zipped = Streams.zip(Stream.of(1,2,3) ,ReactiveSeq.of(2,3,4), (a,b) -> Arrays.asList(a,b)); List<Integer> zip = zipped.collect(CyclopsCollectors.toList()).getValue(1); assertThat(zip.getValue(0),equalTo(2)); assertThat(zip....
[ "Generic", "zip", "function", ".", "E", ".", "g", ".", "Zipping", "a", "Stream", "and", "a", "Sequence" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1596-L1614
48,066
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.grouped
public final static <T> Stream<Vector<T>> grouped(final Stream<T> stream, final int groupSize) { return StreamSupport.stream(new GroupingSpliterator<>(stream.spliterator(),()->Vector.empty(), c->Vector.fromIterable(c),groupSize),stream.isParallel()); }
java
public final static <T> Stream<Vector<T>> grouped(final Stream<T> stream, final int groupSize) { return StreamSupport.stream(new GroupingSpliterator<>(stream.spliterator(),()->Vector.empty(), c->Vector.fromIterable(c),groupSize),stream.isParallel()); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "Vector", "<", "T", ">", ">", "grouped", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "int", "groupSize", ")", "{", "return", "StreamSupport", ".", "stream", "(", "new", "Gr...
Group elements in a Stream by size <pre> {@code List<List<Integer>> list = Streams.grouped(Stream.of(1,2,3,4,5,6) ,3) .collect(CyclopsCollectors.toList()); assertThat(list.getValue(0),hasItems(1,2,3)); assertThat(list.getValue(1),hasItems(4,5,6)); } </pre> @param stream Stream to group @param groupSize Size of each ...
[ "Group", "elements", "in", "a", "Stream", "by", "size" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1770-L1775
48,067
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.scanLeft
public final static <T> Stream<T> scanLeft(final Stream<T> stream, final Monoid<T> monoid) { final Iterator<T> it = stream.iterator(); return Streams.stream(new Iterator<T>() { boolean init = false; T next = monoid.zero(); @Override public boolean hasNex...
java
public final static <T> Stream<T> scanLeft(final Stream<T> stream, final Monoid<T> monoid) { final Iterator<T> it = stream.iterator(); return Streams.stream(new Iterator<T>() { boolean init = false; T next = monoid.zero(); @Override public boolean hasNex...
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "T", ">", "scanLeft", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Monoid", "<", "T", ">", "monoid", ")", "{", "final", "Iterator", "<", "T", ">", "it", "=", "stream", ...
Scan left using supplied Monoid <pre> {@code assertEquals(asList("", "a", "ab", "abc"), Streams.scanLeft(Stream.of("a", "b", "c"),Reducers.toString("")) .collect(CyclopsCollectors.toList()); } </pre> @param monoid @return
[ "Scan", "left", "using", "supplied", "Monoid" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1839-L1866
48,068
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.xMatch
public static <T> boolean xMatch(final Stream<T> stream, final int num, final Predicate<? super T> c) { return stream.filter(t -> c.test(t)) .collect(java.util.stream.Collectors.counting()) == num; }
java
public static <T> boolean xMatch(final Stream<T> stream, final int num, final Predicate<? super T> c) { return stream.filter(t -> c.test(t)) .collect(java.util.stream.Collectors.counting()) == num; }
[ "public", "static", "<", "T", ">", "boolean", "xMatch", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "int", "num", ",", "final", "Predicate", "<", "?", "super", "T", ">", "c", ")", "{", "return", "stream", ".", "filter", "(", "t",...
Check that there are specified number of matches of predicate in the Stream <pre> {@code assertTrue(Streams.xMatch(Stream.of(1,2,3,5,6,7),3, i->i>4)); } </pre>
[ "Check", "that", "there", "are", "specified", "number", "of", "matches", "of", "predicate", "in", "the", "Stream" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1878-L1882
48,069
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.foldMap
public final static <T, R> R foldMap(final Stream<T> stream, final Function<? super T, ? extends R> mapper, final Monoid<R> reducer) { return reducer.foldLeft(stream.map(mapper)); }
java
public final static <T, R> R foldMap(final Stream<T> stream, final Function<? super T, ? extends R> mapper, final Monoid<R> reducer) { return reducer.foldLeft(stream.map(mapper)); }
[ "public", "final", "static", "<", "T", ",", "R", ">", "R", "foldMap", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Function", "<", "?", "super", "T", ",", "?", "extends", "R", ">", "mapper", ",", "final", "Monoid", "<", "R", ">...
Attempt to transform this Stream to the same type as the supplied Monoid, using supplied function Then use Monoid to reduce values @param mapper Function to transform Monad type @param reducer Monoid to reduce values @return Reduce result
[ "Attempt", "to", "transform", "this", "Stream", "to", "the", "same", "type", "as", "the", "supplied", "Monoid", "using", "supplied", "function", "Then", "use", "Monoid", "to", "reduce", "values" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1952-L1954
48,070
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.intersperse
public static <T> Stream<T> intersperse(final Stream<T> stream, final T value) { return stream.flatMap(t -> Stream.of(value, t)) .skip(1); }
java
public static <T> Stream<T> intersperse(final Stream<T> stream, final T value) { return stream.flatMap(t -> Stream.of(value, t)) .skip(1); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "intersperse", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "T", "value", ")", "{", "return", "stream", ".", "flatMap", "(", "t", "->", "Stream", ".", "of", "(", "value",...
Returns a stream with a given value interspersed between any two values of this stream. <pre> {@code assertThat(Arrays.asList(1, 0, 2, 0, 3, 0, 4), equalTo( Streams.intersperse(Stream.of(1, 2, 3, 4),0)); } </pre>
[ "Returns", "a", "stream", "with", "a", "given", "value", "interspersed", "between", "any", "two", "values", "of", "this", "stream", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2130-L2133
48,071
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.ofType
@SuppressWarnings("unchecked") public static <T, U> Stream<U> ofType(final Stream<T> stream, final Class<? extends U> type) { return stream.filter(type::isInstance) .map(t -> (U) t); }
java
@SuppressWarnings("unchecked") public static <T, U> Stream<U> ofType(final Stream<T> stream, final Class<? extends U> type) { return stream.filter(type::isInstance) .map(t -> (U) t); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ",", "U", ">", "Stream", "<", "U", ">", "ofType", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Class", "<", "?", "extends", "U", ">", "type", ")", ...
Keep only those elements in a stream that are of a given type. assertThat(Arrays.asList(1, 2, 3), equalTo( Streams.ofType(Stream.of(1, "a", 2, "b", 3,Integer.class));
[ "Keep", "only", "those", "elements", "in", "a", "stream", "that", "are", "of", "a", "given", "type", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2143-L2147
48,072
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.flatMapCharSequence
public final static <T> Stream<Character> flatMapCharSequence(final Stream<T> stream, final Function<? super T, CharSequence> fn) { return stream.flatMap(fn.andThen(CharSequence::chars) .andThen(s->s.mapToObj(i->Character.toChars(i)[0]))); }
java
public final static <T> Stream<Character> flatMapCharSequence(final Stream<T> stream, final Function<? super T, CharSequence> fn) { return stream.flatMap(fn.andThen(CharSequence::chars) .andThen(s->s.mapToObj(i->Character.toChars(i)[0]))); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "Character", ">", "flatMapCharSequence", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Function", "<", "?", "super", "T", ",", "CharSequence", ">", "fn", ")", "{", "return", "...
rename -flatMapCharSequence
[ "rename", "-", "flatMapCharSequence" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2265-L2268
48,073
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.flatMapFile
public final static <T> Stream<String> flatMapFile(final Stream<T> stream, final Function<? super T, File> fn) { return stream.flatMap(fn.andThen(f->ExceptionSoftener.softenSupplier(()->Files.lines(Paths.get(f.getAbsolutePath()) ) ).get())); }
java
public final static <T> Stream<String> flatMapFile(final Stream<T> stream, final Function<? super T, File> fn) { return stream.flatMap(fn.andThen(f->ExceptionSoftener.softenSupplier(()->Files.lines(Paths.get(f.getAbsolutePath()) ) ).get())); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "String", ">", "flatMapFile", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Function", "<", "?", "super", "T", ",", "File", ">", "fn", ")", "{", "return", "stream", ".", "...
Perform a flatMap operation where the result will be a flattened stream of Strings from the text loaded from the supplied files. <pre> {@code List<String> result = Streams.liftAndBindFile(Stream.of("input.file") .map(getClass().getClassLoader()::getResource) .peek(System.out::println) .map(URL::getFile) ,File::new) ....
[ "Perform", "a", "flatMap", "operation", "where", "the", "result", "will", "be", "a", "flattened", "stream", "of", "Strings", "from", "the", "text", "loaded", "from", "the", "supplied", "files", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2293-L2295
48,074
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.flatMapURL
public final static <T> Stream<String> flatMapURL(final Stream<T> stream, final Function<? super T, URL> fn) { return stream.flatMap(fn.andThen(url -> ExceptionSoftener.softenSupplier(() -> { final BufferedReader in = new BufferedReader( new I...
java
public final static <T> Stream<String> flatMapURL(final Stream<T> stream, final Function<? super T, URL> fn) { return stream.flatMap(fn.andThen(url -> ExceptionSoftener.softenSupplier(() -> { final BufferedReader in = new BufferedReader( new I...
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "String", ">", "flatMapURL", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Function", "<", "?", "super", "T", ",", "URL", ">", "fn", ")", "{", "return", "stream", ".", "fl...
Perform a flatMap operation where the result will be a flattened stream of Strings from the text loaded from the supplied URLs <pre> {@code List<String> result = Streams.liftAndBindURL(Stream.of("input.file") ,getClass().getClassLoader()::getResource) .collect(CyclopsCollectors.toList(); assertThat(result,equalTo(Arr...
[ "Perform", "a", "flatMap", "operation", "where", "the", "result", "will", "be", "a", "flattened", "stream", "of", "Strings", "from", "the", "text", "loaded", "from", "the", "supplied", "URLs" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2315-L2325
48,075
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.flatMapBufferedReader
public final static <T> Stream<String> flatMapBufferedReader(final Stream<T> stream, final Function<? super T, BufferedReader> fn) { return stream.flatMap(fn.andThen(in -> ExceptionSoftener.softenSupplier(() -> { return in.lines(); }) .get())); ...
java
public final static <T> Stream<String> flatMapBufferedReader(final Stream<T> stream, final Function<? super T, BufferedReader> fn) { return stream.flatMap(fn.andThen(in -> ExceptionSoftener.softenSupplier(() -> { return in.lines(); }) .get())); ...
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "String", ">", "flatMapBufferedReader", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Function", "<", "?", "super", "T", ",", "BufferedReader", ">", "fn", ")", "{", "return", ...
Perform a flatMap operation where the result will be a flattened stream of Strings from the text loaded from the supplied BufferedReaders <pre> List<String> result = Streams.liftAndBindBufferedReader(Stream.of("input.file") .map(getClass().getClassLoader()::getResourceAsStream) .map(InputStreamReader::new) ,BufferedRe...
[ "Perform", "a", "flatMap", "operation", "where", "the", "result", "will", "be", "a", "flattened", "stream", "of", "Strings", "from", "the", "text", "loaded", "from", "the", "supplied", "BufferedReaders" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2346-L2353
48,076
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.groupedStatefullyUntil
public final static <T> Stream<Seq<T>> groupedStatefullyUntil(final Stream<T> stream, final BiPredicate<Seq<? super T>, ? super T> predicate) { return StreamSupport.stream(new GroupedStatefullySpliterator<>(stream.spliterator(),()->Seq.of(),Function.identity(),predicate.negate()),stream.isParallel()...
java
public final static <T> Stream<Seq<T>> groupedStatefullyUntil(final Stream<T> stream, final BiPredicate<Seq<? super T>, ? super T> predicate) { return StreamSupport.stream(new GroupedStatefullySpliterator<>(stream.spliterator(),()->Seq.of(),Function.identity(),predicate.negate()),stream.isParallel()...
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "Seq", "<", "T", ">", ">", "groupedStatefullyUntil", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "BiPredicate", "<", "Seq", "<", "?", "super", "T", ">", ",", "?", "super", ...
Group data in a Stream using knowledge of the current batch and the next entry to determing grouping limits @see Traversable#groupedUntil(BiPredicate) @param stream Stream to group @param predicate Predicate to determine grouping @return Stream grouped into Lists determined by predicate
[ "Group", "data", "in", "a", "Stream", "using", "knowledge", "of", "the", "current", "batch", "and", "the", "next", "entry", "to", "determing", "grouping", "limits" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2600-L2603
48,077
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.groupedUntil
public final static <T> Stream<Seq<T>> groupedUntil(final Stream<T> stream, final Predicate<? super T> predicate) { return groupedWhile(stream, predicate.negate()); }
java
public final static <T> Stream<Seq<T>> groupedUntil(final Stream<T> stream, final Predicate<? super T> predicate) { return groupedWhile(stream, predicate.negate()); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "Seq", "<", "T", ">", ">", "groupedUntil", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "return", "groupedWh...
Group a Stream until the supplied predicate holds @see ReactiveSeq#groupedUntil(Predicate) @param stream Stream to group @param predicate Predicate to determine grouping @return Stream grouped into Lists determined by predicate
[ "Group", "a", "Stream", "until", "the", "supplied", "predicate", "holds" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2651-L2653
48,078
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.debounce
public final static <T> Stream<T> debounce(final Stream<T> stream, final long time, final TimeUnit t) { return new DebounceOperator<>( stream).debounce(time, t); }
java
public final static <T> Stream<T> debounce(final Stream<T> stream, final long time, final TimeUnit t) { return new DebounceOperator<>( stream).debounce(time, t); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "T", ">", "debounce", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "long", "time", ",", "final", "TimeUnit", "t", ")", "{", "return", "new", "DebounceOperator", "<>", "(", "...
Allow one element through per time period, drop all other elements in that time period @see ReactiveSeq#debounce(long, TimeUnit) @param stream Stream to debounce @param time Time to applyHKT debouncing over @param t Time unit for debounce period @return Stream with debouncing applied
[ "Allow", "one", "element", "through", "per", "time", "period", "drop", "all", "other", "elements", "in", "that", "time", "period" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2706-L2709
48,079
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.onePer
public final static <T> Stream<T> onePer(final Stream<T> stream, final long time, final TimeUnit t) { return new OnePerOperator<>( stream).onePer(time, t); }
java
public final static <T> Stream<T> onePer(final Stream<T> stream, final long time, final TimeUnit t) { return new OnePerOperator<>( stream).onePer(time, t); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "T", ">", "onePer", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "long", "time", ",", "final", "TimeUnit", "t", ")", "{", "return", "new", "OnePerOperator", "<>", "(", "stre...
emit one element per time period @see ReactiveSeq#onePer(long, TimeUnit) @param stream Stream to emit one element per time period from @param time Time period @param t Time Pure @return Stream with slowed emission
[ "emit", "one", "element", "per", "time", "period" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2721-L2724
48,080
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/box/MutableLong.java
MutableLong.fromExternal
public static MutableLong fromExternal(final LongSupplier s, final LongConsumer c) { return new MutableLong() { @Override public long getAsLong() { return s.getAsLong(); } @Override public Long get() { return getAsLong(...
java
public static MutableLong fromExternal(final LongSupplier s, final LongConsumer c) { return new MutableLong() { @Override public long getAsLong() { return s.getAsLong(); } @Override public Long get() { return getAsLong(...
[ "public", "static", "MutableLong", "fromExternal", "(", "final", "LongSupplier", "s", ",", "final", "LongConsumer", "c", ")", "{", "return", "new", "MutableLong", "(", ")", "{", "@", "Override", "public", "long", "getAsLong", "(", ")", "{", "return", "s", ...
Construct a MutableLong that gets and sets an external value using the provided Supplier and Consumer e.g. <pre> {@code MutableLong mutable = MutableLong.fromExternal(()->!this.value,val->!this.value); } </pre> @param s Supplier of an external value @param c Consumer that sets an external value @return MutableLong t...
[ "Construct", "a", "MutableLong", "that", "gets", "and", "sets", "an", "external", "value", "using", "the", "provided", "Supplier", "and", "Consumer" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableLong.java#L81-L99
48,081
aol/cyclops
cyclops-futurestream/src/main/java/com/oath/cyclops/react/StageWithResults.java
StageWithResults.submit
public <R> R submit(final Function<RS, R> fn) { return submit(() -> fn.apply(this.results)); }
java
public <R> R submit(final Function<RS, R> fn) { return submit(() -> fn.apply(this.results)); }
[ "public", "<", "R", ">", "R", "submit", "(", "final", "Function", "<", "RS", ",", "R", ">", "fn", ")", "{", "return", "submit", "(", "(", ")", "->", "fn", ".", "apply", "(", "this", ".", "results", ")", ")", ";", "}" ]
This method allows the SimpleReact Executor to be reused by JDK parallel streams. It is best used when collectResults and block are called explicitly for finer grained control over the blocking conditions. @param fn Function that contains parallelStream code to be executed by the SimpleReact ForkJoinPool (if configure...
[ "This", "method", "allows", "the", "SimpleReact", "Executor", "to", "be", "reused", "by", "JDK", "parallel", "streams", ".", "It", "is", "best", "used", "when", "collectResults", "and", "block", "are", "called", "explicitly", "for", "finer", "grained", "contro...
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/react/StageWithResults.java#L38-L40
48,082
aol/cyclops
cyclops-futurestream/src/main/java/com/oath/cyclops/react/StageWithResults.java
StageWithResults.submit
public <T> T submit(final Callable<T> callable) { if (taskExecutor instanceof ForkJoinPool) { try { return ((ForkJoinPool) taskExecutor).submit(callable) .get(); } catch (final ExecutionException e) { th...
java
public <T> T submit(final Callable<T> callable) { if (taskExecutor instanceof ForkJoinPool) { try { return ((ForkJoinPool) taskExecutor).submit(callable) .get(); } catch (final ExecutionException e) { th...
[ "public", "<", "T", ">", "T", "submit", "(", "final", "Callable", "<", "T", ">", "callable", ")", "{", "if", "(", "taskExecutor", "instanceof", "ForkJoinPool", ")", "{", "try", "{", "return", "(", "(", "ForkJoinPool", ")", "taskExecutor", ")", ".", "su...
This method allows the SimpleReact Executor to be reused by JDK parallel streams @param callable that contains code
[ "This", "method", "allows", "the", "SimpleReact", "Executor", "to", "be", "reused", "by", "JDK", "parallel", "streams" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/react/StageWithResults.java#L47-L69
48,083
aol/cyclops
cyclops/src/main/java/cyclops/function/Memoize.java
Memoize.memoizeSupplierAsync
public static <R> Function0<R> memoizeSupplierAsync(final Supplier<R> fn, ScheduledExecutorService ex, long updateRateInMillis){ return ()-> Memoize.memoizeFunctionAsync(a-> fn.get(),ex,updateRateInMillis) .apply("k"); }
java
public static <R> Function0<R> memoizeSupplierAsync(final Supplier<R> fn, ScheduledExecutorService ex, long updateRateInMillis){ return ()-> Memoize.memoizeFunctionAsync(a-> fn.get(),ex,updateRateInMillis) .apply("k"); }
[ "public", "static", "<", "R", ">", "Function0", "<", "R", ">", "memoizeSupplierAsync", "(", "final", "Supplier", "<", "R", ">", "fn", ",", "ScheduledExecutorService", "ex", ",", "long", "updateRateInMillis", ")", "{", "return", "(", ")", "->", "Memoize", "...
Memoize a Supplier and update the cached values asynchronously using the provided Scheduled Executor Service Does not support null keys @param fn Supplier to Memoize @param ex Scheduled Executor Service @param updateRateInMillis Time in millis between async updates @param <R> Return type of Function @return Memoized a...
[ "Memoize", "a", "Supplier", "and", "update", "the", "cached", "values", "asynchronously", "using", "the", "provided", "Scheduled", "Executor", "Service", "Does", "not", "support", "null", "keys" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/Memoize.java#L74-L77
48,084
aol/cyclops
cyclops/src/main/java/cyclops/function/Memoize.java
Memoize.memoizeBiFunction
public static <T1, T2, R> Function2<T1, T2, R> memoizeBiFunction(final BiFunction<T1, T2, R> fn) { Function1<Tuple2<T1, T2>, R> memoise2 = memoizeFunction((final Tuple2<T1, T2> pair) -> fn.apply(pair._1(), pair._2())); return (t1, t2) -> memoise2.apply(tuple(t1, t2)); }
java
public static <T1, T2, R> Function2<T1, T2, R> memoizeBiFunction(final BiFunction<T1, T2, R> fn) { Function1<Tuple2<T1, T2>, R> memoise2 = memoizeFunction((final Tuple2<T1, T2> pair) -> fn.apply(pair._1(), pair._2())); return (t1, t2) -> memoise2.apply(tuple(t1, t2)); }
[ "public", "static", "<", "T1", ",", "T2", ",", "R", ">", "Function2", "<", "T1", ",", "T2", ",", "R", ">", "memoizeBiFunction", "(", "final", "BiFunction", "<", "T1", ",", "T2", ",", "R", ">", "fn", ")", "{", "Function1", "<", "Tuple2", "<", "T1"...
Convert a BiFunction into one that caches it's result @param fn BiFunction to memoise @return Memoised BiFunction
[ "Convert", "a", "BiFunction", "into", "one", "that", "caches", "it", "s", "result" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/Memoize.java#L253-L256
48,085
aol/cyclops
cyclops/src/main/java/cyclops/function/Memoize.java
Memoize.memoizeTriFunction
public static <T1, T2, T3, R> Function3<T1, T2, T3, R> memoizeTriFunction(final Function3<T1, T2, T3, R> fn, final Cacheable<R> cache) { Function1<Tuple3<T1, T2, T3>, R> memoise2 = memoizeFunction((final Tuple3<T1, T2, T3> triple) -> fn.apply(triple._1(), triple._2(), triple._3()), cache); return (t1, t2,...
java
public static <T1, T2, T3, R> Function3<T1, T2, T3, R> memoizeTriFunction(final Function3<T1, T2, T3, R> fn, final Cacheable<R> cache) { Function1<Tuple3<T1, T2, T3>, R> memoise2 = memoizeFunction((final Tuple3<T1, T2, T3> triple) -> fn.apply(triple._1(), triple._2(), triple._3()), cache); return (t1, t2,...
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "R", ">", "Function3", "<", "T1", ",", "T2", ",", "T3", ",", "R", ">", "memoizeTriFunction", "(", "final", "Function3", "<", "T1", ",", "T2", ",", "T3", ",", "R", ">", "fn", ",", "final"...
Convert a TriFunction into one that caches it's result @param fn TriFunction to memoise @param cache Cachable to store the results @return Memoised TriFunction
[ "Convert", "a", "TriFunction", "into", "one", "that", "caches", "it", "s", "result" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/Memoize.java#L301-L304
48,086
aol/cyclops
cyclops/src/main/java/cyclops/function/Memoize.java
Memoize.memoizeQuadFunction
public static <T1, T2, T3, T4, R> Function4<T1, T2, T3, T4, R> memoizeQuadFunction(final Function4<T1, T2, T3, T4, R> fn) { Function1<Tuple4<T1, T2, T3, T4>, R> memoise2 = memoizeFunction((final Tuple4<T1, T2, T3, T4> quad) -> fn.apply(quad._1(), quad._2(), quad._3(), quad._4())); return (t1, t2, t3, t4) ...
java
public static <T1, T2, T3, T4, R> Function4<T1, T2, T3, T4, R> memoizeQuadFunction(final Function4<T1, T2, T3, T4, R> fn) { Function1<Tuple4<T1, T2, T3, T4>, R> memoise2 = memoizeFunction((final Tuple4<T1, T2, T3, T4> quad) -> fn.apply(quad._1(), quad._2(), quad._3(), quad._4())); return (t1, t2, t3, t4) ...
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "R", ">", "Function4", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "R", ">", "memoizeQuadFunction", "(", "final", "Function4", "<", "T1", ",", "T2", ",", "T3", ",", "T4",...
Convert a QuadFunction into one that caches it's result @param fn QuadFunction to memoise @return Memoised TriFunction
[ "Convert", "a", "QuadFunction", "into", "one", "that", "caches", "it", "s", "result" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/Memoize.java#L324-L327
48,087
aol/cyclops
cyclops/src/main/java/cyclops/function/Memoize.java
Memoize.memoizePredicate
public static <T> Predicate<T> memoizePredicate(final Predicate<T> p, final Cacheable<Boolean> cache) { final Function<T, Boolean> memoised = memoizeFunction((Function<T, Boolean>) t -> p.test(t), cache); LazyImmutable<Boolean> nullR = LazyImmutable.def(); return (t) -> t==null? nullR.computeIfA...
java
public static <T> Predicate<T> memoizePredicate(final Predicate<T> p, final Cacheable<Boolean> cache) { final Function<T, Boolean> memoised = memoizeFunction((Function<T, Boolean>) t -> p.test(t), cache); LazyImmutable<Boolean> nullR = LazyImmutable.def(); return (t) -> t==null? nullR.computeIfA...
[ "public", "static", "<", "T", ">", "Predicate", "<", "T", ">", "memoizePredicate", "(", "final", "Predicate", "<", "T", ">", "p", ",", "final", "Cacheable", "<", "Boolean", ">", "cache", ")", "{", "final", "Function", "<", "T", ",", "Boolean", ">", "...
Convert a Predicate into one that caches it's result @param p Predicate to memoise @param cache Cachable to store the results @return Memoised Predicate
[ "Convert", "a", "Predicate", "into", "one", "that", "caches", "it", "s", "result" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/Memoize.java#L388-L392
48,088
aol/cyclops
cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java
Monos.anyOf
public static <T> Mono<T> anyOf(Mono<T>... fts) { return Mono.from(Future.anyOf(futures(fts))); }
java
public static <T> Mono<T> anyOf(Mono<T>... fts) { return Mono.from(Future.anyOf(futures(fts))); }
[ "public", "static", "<", "T", ">", "Mono", "<", "T", ">", "anyOf", "(", "Mono", "<", "T", ">", "...", "fts", ")", "{", "return", "Mono", ".", "from", "(", "Future", ".", "anyOf", "(", "futures", "(", "fts", ")", ")", ")", ";", "}" ]
Select the first Mono to complete @see CompletableFuture#anyOf(CompletableFuture...) @param fts Monos to race @return First Mono to complete
[ "Select", "the", "first", "Mono", "to", "complete" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java#L102-L105
48,089
aol/cyclops
cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java
Monos.forEach3
public static <T1, T2, R1, R2, R> Mono<R> forEach3(Mono<? extends T1> value1, Function<? super T1, ? extends Mono<R1>> value2, BiFunction<? super T1, ? super R1, ? extends Mono<R2>> value3, Function3<? super T1, ? super R1, ? super R2, ? extends R> yieldingFunction) { Future...
java
public static <T1, T2, R1, R2, R> Mono<R> forEach3(Mono<? extends T1> value1, Function<? super T1, ? extends Mono<R1>> value2, BiFunction<? super T1, ? super R1, ? extends Mono<R2>> value3, Function3<? super T1, ? super R1, ? super R2, ? extends R> yieldingFunction) { Future...
[ "public", "static", "<", "T1", ",", "T2", ",", "R1", ",", "R2", ",", "R", ">", "Mono", "<", "R", ">", "forEach3", "(", "Mono", "<", "?", "extends", "T1", ">", "value1", ",", "Function", "<", "?", "super", "T1", ",", "?", "extends", "Mono", "<",...
Perform a For Comprehension over a Mono, accepting 2 generating functions. This results in a three level nested internal iteration over the provided Monos. <pre> {@code import static cyclops.companion.reactor.Monos.forEach3; forEach3(Mono.just(1), a-> Mono.just(a+1), (a,b) -> Mono.<Integer>just(a+b), Tuple::tuple) ...
[ "Perform", "a", "For", "Comprehension", "over", "a", "Mono", "accepting", "2", "generating", "functions", ".", "This", "results", "in", "a", "three", "level", "nested", "internal", "iteration", "over", "the", "provided", "Monos", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java#L270-L290
48,090
aol/cyclops
cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java
Monos.forEach
public static <T, R1, R> Mono<R> forEach(Mono<? extends T> value1, Function<? super T, Mono<R1>> value2, BiFunction<? super T, ? super R1, ? extends R> yieldingFunction) { Future<R> res = Future.fromPublisher(value1).flat...
java
public static <T, R1, R> Mono<R> forEach(Mono<? extends T> value1, Function<? super T, Mono<R1>> value2, BiFunction<? super T, ? super R1, ? extends R> yieldingFunction) { Future<R> res = Future.fromPublisher(value1).flat...
[ "public", "static", "<", "T", ",", "R1", ",", "R", ">", "Mono", "<", "R", ">", "forEach", "(", "Mono", "<", "?", "extends", "T", ">", "value1", ",", "Function", "<", "?", "super", "T", ",", "Mono", "<", "R1", ">", ">", "value2", ",", "BiFunctio...
Perform a For Comprehension over a Mono, accepting a generating function. This results in a two level nested internal iteration over the provided Monos. <pre> {@code import static cyclops.companion.reactor.Monos.forEach; forEach(Mono.just(1), a-> Mono.just(a+1), Tuple::tuple) } </pre> @param value1 top level Mono ...
[ "Perform", "a", "For", "Comprehension", "over", "a", "Mono", "accepting", "a", "generating", "function", ".", "This", "results", "in", "a", "two", "level", "nested", "internal", "iteration", "over", "the", "provided", "Monos", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java#L315-L330
48,091
aol/cyclops
cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java
Monos.fromIterable
public static <T> Mono<T> fromIterable(Iterable<T> t) { return Mono.from(Flux.fromIterable(t)); }
java
public static <T> Mono<T> fromIterable(Iterable<T> t) { return Mono.from(Flux.fromIterable(t)); }
[ "public", "static", "<", "T", ">", "Mono", "<", "T", ">", "fromIterable", "(", "Iterable", "<", "T", ">", "t", ")", "{", "return", "Mono", ".", "from", "(", "Flux", ".", "fromIterable", "(", "t", ")", ")", ";", "}" ]
Construct a Mono from Iterable by taking the first value from Iterable @param t Iterable to populate Mono from @return Mono containing first element from Iterable (or empty Mono)
[ "Construct", "a", "Mono", "from", "Iterable", "by", "taking", "the", "first", "value", "from", "Iterable" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java#L398-L400
48,092
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/box/MutableShort.java
MutableShort.fromExternal
public static MutableShort fromExternal(final Supplier<Short> s, final Consumer<Short> c) { return new MutableShort() { @Override public short getAsShort() { return s.get(); } @Override public Short get() { return getAs...
java
public static MutableShort fromExternal(final Supplier<Short> s, final Consumer<Short> c) { return new MutableShort() { @Override public short getAsShort() { return s.get(); } @Override public Short get() { return getAs...
[ "public", "static", "MutableShort", "fromExternal", "(", "final", "Supplier", "<", "Short", ">", "s", ",", "final", "Consumer", "<", "Short", ">", "c", ")", "{", "return", "new", "MutableShort", "(", ")", "{", "@", "Override", "public", "short", "getAsShor...
Construct a MutableShort that gets and sets an external value using the provided Supplier and Consumer e.g. <pre> {@code MutableShort mutable = MutableShort.fromExternal(()->!this.value,val->!this.value); } </pre> @param s Supplier of an external value @param c Consumer that sets an external value @return MutableSho...
[ "Construct", "a", "MutableShort", "that", "gets", "and", "sets", "an", "external", "value", "using", "the", "provided", "Supplier", "and", "Consumer" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableShort.java#L81-L99
48,093
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/internal/stream/SeqUtils.java
SeqUtils.cycle
public static <U> Stream<U> cycle(final int times, final Streamable<U> s) { return Stream.iterate(s.stream(), s1 -> s.stream()) .limit(times) .flatMap(Function.identity()); }
java
public static <U> Stream<U> cycle(final int times, final Streamable<U> s) { return Stream.iterate(s.stream(), s1 -> s.stream()) .limit(times) .flatMap(Function.identity()); }
[ "public", "static", "<", "U", ">", "Stream", "<", "U", ">", "cycle", "(", "final", "int", "times", ",", "final", "Streamable", "<", "U", ">", "s", ")", "{", "return", "Stream", ".", "iterate", "(", "s", ".", "stream", "(", ")", ",", "s1", "->", ...
Create a Stream that finitely cycles the provided Streamable, provided number of times <pre> {@code assertThat(StreamUtils.cycle(3,Streamable.of(1,2,2)) .collect(CyclopsCollectors.toList()), equalTo(Arrays.asList(1,2,2,1,2,2,1,2,2))); } </pre> @param s Streamable to cycle @return New cycling stream
[ "Create", "a", "Stream", "that", "finitely", "cycles", "the", "provided", "Streamable", "provided", "number", "of", "times" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/SeqUtils.java#L70-L74
48,094
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/internal/stream/SeqUtils.java
SeqUtils.toConcurrentLazyCollection
public static final <A> Collection<A> toConcurrentLazyCollection(final Stream<A> stream) { return toConcurrentLazyCollection(stream.iterator()); }
java
public static final <A> Collection<A> toConcurrentLazyCollection(final Stream<A> stream) { return toConcurrentLazyCollection(stream.iterator()); }
[ "public", "static", "final", "<", "A", ">", "Collection", "<", "A", ">", "toConcurrentLazyCollection", "(", "final", "Stream", "<", "A", ">", "stream", ")", "{", "return", "toConcurrentLazyCollection", "(", "stream", ".", "iterator", "(", ")", ")", ";", "}...
Lazily constructs a Collection from specified Stream. Collections iterator may be safely used concurrently by multiple threads.
[ "Lazily", "constructs", "a", "Collection", "from", "specified", "Stream", ".", "Collections", "iterator", "may", "be", "safely", "used", "concurrently", "by", "multiple", "threads", "." ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/SeqUtils.java#L94-L96
48,095
aol/cyclops
cyclops-anym/src/main/java/cyclops/monads/transformers/jdk/OptionalT.java
OptionalT.map
@Override public <B> OptionalT<W,B> map(final Function<? super T, ? extends B> f) { return new OptionalT<W,B>( run.map(o -> o.map(f))); }
java
@Override public <B> OptionalT<W,B> map(final Function<? super T, ? extends B> f) { return new OptionalT<W,B>( run.map(o -> o.map(f))); }
[ "@", "Override", "public", "<", "B", ">", "OptionalT", "<", "W", ",", "B", ">", "map", "(", "final", "Function", "<", "?", "super", "T", ",", "?", "extends", "B", ">", "f", ")", "{", "return", "new", "OptionalT", "<", "W", ",", "B", ">", "(", ...
Map the wrapped Optional <pre> {@code OptionalWT.of(AnyM.fromStream(Arrays.asOptionalW(10)) .map(t->t=t+1); //OptionalWT<AnyMSeq<Stream<Optional[11]>>> } </pre> @param f Mapping function for the wrapped Optional @return OptionalWT that applies the transform function to the wrapped Optional
[ "Map", "the", "wrapped", "Optional" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-anym/src/main/java/cyclops/monads/transformers/jdk/OptionalT.java#L129-L133
48,096
aol/cyclops
cyclops-anym/src/main/java/cyclops/monads/transformers/jdk/OptionalT.java
OptionalT.of
public static <W extends WitnessType<W>,A> OptionalT<W,A> of(final AnyM<W,Optional<A>> monads) { return new OptionalT<>( monads); }
java
public static <W extends WitnessType<W>,A> OptionalT<W,A> of(final AnyM<W,Optional<A>> monads) { return new OptionalT<>( monads); }
[ "public", "static", "<", "W", "extends", "WitnessType", "<", "W", ">", ",", "A", ">", "OptionalT", "<", "W", ",", "A", ">", "of", "(", "final", "AnyM", "<", "W", ",", "Optional", "<", "A", ">", ">", "monads", ")", "{", "return", "new", "OptionalT...
Construct an OptionalWT from an AnyM that wraps a monad containing OptionalWs @param monads AnyM that contains a monad wrapping an Optional @return OptionalWT
[ "Construct", "an", "OptionalWT", "from", "an", "AnyM", "that", "wraps", "a", "monad", "containing", "OptionalWs" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-anym/src/main/java/cyclops/monads/transformers/jdk/OptionalT.java#L252-L255
48,097
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/types/reactive/QueueBasedSubscriber.java
QueueBasedSubscriber.subscriber
public static <T> QueueBasedSubscriber<T> subscriber(final Counter counter, final int maxConcurrency) { return new QueueBasedSubscriber<>( counter, maxConcurrency); }
java
public static <T> QueueBasedSubscriber<T> subscriber(final Counter counter, final int maxConcurrency) { return new QueueBasedSubscriber<>( counter, maxConcurrency); }
[ "public", "static", "<", "T", ">", "QueueBasedSubscriber", "<", "T", ">", "subscriber", "(", "final", "Counter", "counter", ",", "final", "int", "maxConcurrency", ")", "{", "return", "new", "QueueBasedSubscriber", "<>", "(", "counter", ",", "maxConcurrency", "...
Create a QueueBasedSubscriber, backed by a JDK LinkedBlockingQueue @param counter Counter for tracking connections to the queue and data volumes @param maxConcurrency Maximum number of subscriptions @return QueueBasedSubscriber
[ "Create", "a", "QueueBasedSubscriber", "backed", "by", "a", "JDK", "LinkedBlockingQueue" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/types/reactive/QueueBasedSubscriber.java#L45-L48
48,098
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/types/reactive/QueueBasedSubscriber.java
QueueBasedSubscriber.subscriber
public static <T> QueueBasedSubscriber<T> subscriber(final Queue<T> q, final Counter counter, final int maxConcurrency) { return new QueueBasedSubscriber<>( q, counter, maxConcurrency); }
java
public static <T> QueueBasedSubscriber<T> subscriber(final Queue<T> q, final Counter counter, final int maxConcurrency) { return new QueueBasedSubscriber<>( q, counter, maxConcurrency); }
[ "public", "static", "<", "T", ">", "QueueBasedSubscriber", "<", "T", ">", "subscriber", "(", "final", "Queue", "<", "T", ">", "q", ",", "final", "Counter", "counter", ",", "final", "int", "maxConcurrency", ")", "{", "return", "new", "QueueBasedSubscriber", ...
Create a QueueBasedSubscriber, backed by the provided Queue @param q Queue backing the reactiveSubscriber @param counter Counter for tracking connections to the queue and data volumes @param maxConcurrency Maximum number of subscriptions @return QueueBasedSubscriber
[ "Create", "a", "QueueBasedSubscriber", "backed", "by", "the", "provided", "Queue" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/types/reactive/QueueBasedSubscriber.java#L58-L61
48,099
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/types/reactive/QueueBasedSubscriber.java
QueueBasedSubscriber.subscriber
public static <T> QueueBasedSubscriber<T> subscriber(final QueueFactory<T> factory, final Counter counter, final int maxConcurrency) { return new QueueBasedSubscriber<>( factory, counter, maxConcurrency); }
java
public static <T> QueueBasedSubscriber<T> subscriber(final QueueFactory<T> factory, final Counter counter, final int maxConcurrency) { return new QueueBasedSubscriber<>( factory, counter, maxConcurrency); }
[ "public", "static", "<", "T", ">", "QueueBasedSubscriber", "<", "T", ">", "subscriber", "(", "final", "QueueFactory", "<", "T", ">", "factory", ",", "final", "Counter", "counter", ",", "final", "int", "maxConcurrency", ")", "{", "return", "new", "QueueBasedS...
Create a QueueBasedSubscriber, backed by a Queue that will be created with the provided QueueFactory @param factory QueueFactory @param counter Counter for tracking connections to the queue and data volumes @param maxConcurrency Maximum number of subscriptions @return QueueBasedSubscriber
[ "Create", "a", "QueueBasedSubscriber", "backed", "by", "a", "Queue", "that", "will", "be", "created", "with", "the", "provided", "QueueFactory" ]
59a9fde30190a4d1faeb9f6d9851d209d82b81dd
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/types/reactive/QueueBasedSubscriber.java#L71-L75