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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
116,400 | vorburger/MariaDB4j | mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java | DB.stop | public synchronized void stop() throws ManagedProcessException {
if (mysqldProcess.isAlive()) {
logger.debug("Stopping the database...");
mysqldProcess.destroy();
logger.info("Database stopped.");
} else {
logger.debug("Database was already stopped.");
... | java | public synchronized void stop() throws ManagedProcessException {
if (mysqldProcess.isAlive()) {
logger.debug("Stopping the database...");
mysqldProcess.destroy();
logger.info("Database stopped.");
} else {
logger.debug("Database was already stopped.");
... | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"throws",
"ManagedProcessException",
"{",
"if",
"(",
"mysqldProcess",
".",
"isAlive",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Stopping the database...\"",
")",
";",
"mysqldProcess",
".",
"destroy",
... | Stops the database.
@throws ManagedProcessException if something fatal went wrong | [
"Stops",
"the",
"database",
"."
] | ddc7aa2a3294c9c56b1127de11949fb33a81ad7b | https://github.com/vorburger/MariaDB4j/blob/ddc7aa2a3294c9c56b1127de11949fb33a81ad7b/mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java#L335-L343 |
116,401 | vorburger/MariaDB4j | mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java | DB.unpackEmbeddedDb | protected void unpackEmbeddedDb() {
if (configuration.getBinariesClassPathLocation() == null) {
logger.info("Not unpacking any embedded database (as BinariesClassPathLocation configuration is null)");
return;
}
try {
Util.extractFromClasspathToFile(configurat... | java | protected void unpackEmbeddedDb() {
if (configuration.getBinariesClassPathLocation() == null) {
logger.info("Not unpacking any embedded database (as BinariesClassPathLocation configuration is null)");
return;
}
try {
Util.extractFromClasspathToFile(configurat... | [
"protected",
"void",
"unpackEmbeddedDb",
"(",
")",
"{",
"if",
"(",
"configuration",
".",
"getBinariesClassPathLocation",
"(",
")",
"==",
"null",
")",
"{",
"logger",
".",
"info",
"(",
"\"Not unpacking any embedded database (as BinariesClassPathLocation configuration is null)... | Based on the current OS, unpacks the appropriate version of MariaDB to the file system based
on the configuration. | [
"Based",
"on",
"the",
"current",
"OS",
"unpacks",
"the",
"appropriate",
"version",
"of",
"MariaDB",
"to",
"the",
"file",
"system",
"based",
"on",
"the",
"configuration",
"."
] | ddc7aa2a3294c9c56b1127de11949fb33a81ad7b | https://github.com/vorburger/MariaDB4j/blob/ddc7aa2a3294c9c56b1127de11949fb33a81ad7b/mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java#L349-L368 |
116,402 | vorburger/MariaDB4j | mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java | DB.prepareDirectories | protected void prepareDirectories() throws ManagedProcessException {
baseDir = Util.getDirectory(configuration.getBaseDir());
libDir = Util.getDirectory(configuration.getLibDir());
try {
String dataDirPath = configuration.getDataDir();
if (Util.isTemporaryDirectory(dataDi... | java | protected void prepareDirectories() throws ManagedProcessException {
baseDir = Util.getDirectory(configuration.getBaseDir());
libDir = Util.getDirectory(configuration.getLibDir());
try {
String dataDirPath = configuration.getDataDir();
if (Util.isTemporaryDirectory(dataDi... | [
"protected",
"void",
"prepareDirectories",
"(",
")",
"throws",
"ManagedProcessException",
"{",
"baseDir",
"=",
"Util",
".",
"getDirectory",
"(",
"configuration",
".",
"getBaseDir",
"(",
")",
")",
";",
"libDir",
"=",
"Util",
".",
"getDirectory",
"(",
"configurati... | If the data directory specified in the configuration is a temporary directory, this deletes
any previous version. It also makes sure that the directory exists.
@throws ManagedProcessException if something fatal went wrong | [
"If",
"the",
"data",
"directory",
"specified",
"in",
"the",
"configuration",
"is",
"a",
"temporary",
"directory",
"this",
"deletes",
"any",
"previous",
"version",
".",
"It",
"also",
"makes",
"sure",
"that",
"the",
"directory",
"exists",
"."
] | ddc7aa2a3294c9c56b1127de11949fb33a81ad7b | https://github.com/vorburger/MariaDB4j/blob/ddc7aa2a3294c9c56b1127de11949fb33a81ad7b/mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java#L376-L388 |
116,403 | vorburger/MariaDB4j | mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java | DB.cleanupOnExit | protected void cleanupOnExit() {
String threadName = "Shutdown Hook Deletion Thread for Temporary DB " + dataDir.toString();
final DB db = this;
Runtime.getRuntime().addShutdownHook(new Thread(threadName) {
@Override
public void run() {
// ManagedProcess ... | java | protected void cleanupOnExit() {
String threadName = "Shutdown Hook Deletion Thread for Temporary DB " + dataDir.toString();
final DB db = this;
Runtime.getRuntime().addShutdownHook(new Thread(threadName) {
@Override
public void run() {
// ManagedProcess ... | [
"protected",
"void",
"cleanupOnExit",
"(",
")",
"{",
"String",
"threadName",
"=",
"\"Shutdown Hook Deletion Thread for Temporary DB \"",
"+",
"dataDir",
".",
"toString",
"(",
")",
";",
"final",
"DB",
"db",
"=",
"this",
";",
"Runtime",
".",
"getRuntime",
"(",
")"... | Adds a shutdown hook to ensure that when the JVM exits, the database is stopped, and any
temporary data directories are cleaned up. | [
"Adds",
"a",
"shutdown",
"hook",
"to",
"ensure",
"that",
"when",
"the",
"JVM",
"exits",
"the",
"database",
"is",
"stopped",
"and",
"any",
"temporary",
"data",
"directories",
"are",
"cleaned",
"up",
"."
] | ddc7aa2a3294c9c56b1127de11949fb33a81ad7b | https://github.com/vorburger/MariaDB4j/blob/ddc7aa2a3294c9c56b1127de11949fb33a81ad7b/mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java#L394-L424 |
116,404 | vorburger/MariaDB4j | mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java | DB.dumpXML | public ManagedProcess dumpXML(File outputFile, String dbName, String user, String password)
throws IOException, ManagedProcessException {
return dump(outputFile, Arrays.asList(dbName), true, true, true, user, password);
} | java | public ManagedProcess dumpXML(File outputFile, String dbName, String user, String password)
throws IOException, ManagedProcessException {
return dump(outputFile, Arrays.asList(dbName), true, true, true, user, password);
} | [
"public",
"ManagedProcess",
"dumpXML",
"(",
"File",
"outputFile",
",",
"String",
"dbName",
",",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"IOException",
",",
"ManagedProcessException",
"{",
"return",
"dump",
"(",
"outputFile",
",",
"Arrays",
".... | unexpected deadlock). | [
"unexpected",
"deadlock",
")",
"."
] | ddc7aa2a3294c9c56b1127de11949fb33a81ad7b | https://github.com/vorburger/MariaDB4j/blob/ddc7aa2a3294c9c56b1127de11949fb33a81ad7b/mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java#L433-L436 |
116,405 | vorburger/MariaDB4j | mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/Util.java | Util.extractFromClasspathToFile | public static int extractFromClasspathToFile(String packagePath, File toDir) throws IOException {
String locationPattern = "classpath*:" + packagePath + "/**";
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resourcePatternResol... | java | public static int extractFromClasspathToFile(String packagePath, File toDir) throws IOException {
String locationPattern = "classpath*:" + packagePath + "/**";
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resourcePatternResol... | [
"public",
"static",
"int",
"extractFromClasspathToFile",
"(",
"String",
"packagePath",
",",
"File",
"toDir",
")",
"throws",
"IOException",
"{",
"String",
"locationPattern",
"=",
"\"classpath*:\"",
"+",
"packagePath",
"+",
"\"/**\"",
";",
"ResourcePatternResolver",
"re... | Extract files from a package on the classpath into a directory.
@param packagePath e.g. "com/stuff" (always forward slash not backslash, never dot)
@param toDir directory to extract to
@return int the number of files copied
@throws java.io.IOException if something goes wrong, including if nothing was found on
classpat... | [
"Extract",
"files",
"from",
"a",
"package",
"on",
"the",
"classpath",
"into",
"a",
"directory",
"."
] | ddc7aa2a3294c9c56b1127de11949fb33a81ad7b | https://github.com/vorburger/MariaDB4j/blob/ddc7aa2a3294c9c56b1127de11949fb33a81ad7b/mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/Util.java#L116-L151 |
116,406 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/internal/GitHubLoginFunction.java | GitHubLoginFunction.connector | private OkHttpConnector connector(GitHubServerConfig config) {
OkHttpClient client = new OkHttpClient().setProxy(getProxy(defaultIfBlank(config.getApiUrl(), GITHUB_URL)));
if (config.getClientCacheSize() > 0) {
Cache cache = toCacheDir().apply(config);
client.setCache(cache);
... | java | private OkHttpConnector connector(GitHubServerConfig config) {
OkHttpClient client = new OkHttpClient().setProxy(getProxy(defaultIfBlank(config.getApiUrl(), GITHUB_URL)));
if (config.getClientCacheSize() > 0) {
Cache cache = toCacheDir().apply(config);
client.setCache(cache);
... | [
"private",
"OkHttpConnector",
"connector",
"(",
"GitHubServerConfig",
"config",
")",
"{",
"OkHttpClient",
"client",
"=",
"new",
"OkHttpClient",
"(",
")",
".",
"setProxy",
"(",
"getProxy",
"(",
"defaultIfBlank",
"(",
"config",
".",
"getApiUrl",
"(",
")",
",",
"... | okHttp connector to be used as backend for GitHub client.
Uses proxy of jenkins
If cache size > 0, uses cache
@return connector to be used as backend for client | [
"okHttp",
"connector",
"to",
"be",
"used",
"as",
"backend",
"for",
"GitHub",
"client",
".",
"Uses",
"proxy",
"of",
"jenkins",
"If",
"cache",
"size",
">",
"0",
"uses",
"cache"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/internal/GitHubLoginFunction.java#L109-L118 |
116,407 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/util/JobInfoHelpers.java | JobInfoHelpers.isBuildable | public static <ITEM extends Item> Predicate<ITEM> isBuildable() {
return new Predicate<ITEM>() {
public boolean apply(ITEM item) {
return item instanceof Job ? ((Job<?, ?>) item).isBuildable() : item instanceof BuildableItem;
}
};
} | java | public static <ITEM extends Item> Predicate<ITEM> isBuildable() {
return new Predicate<ITEM>() {
public boolean apply(ITEM item) {
return item instanceof Job ? ((Job<?, ?>) item).isBuildable() : item instanceof BuildableItem;
}
};
} | [
"public",
"static",
"<",
"ITEM",
"extends",
"Item",
">",
"Predicate",
"<",
"ITEM",
">",
"isBuildable",
"(",
")",
"{",
"return",
"new",
"Predicate",
"<",
"ITEM",
">",
"(",
")",
"{",
"public",
"boolean",
"apply",
"(",
"ITEM",
"item",
")",
"{",
"return",
... | Can be useful to ignore disabled jobs on reregistering hooks
@return predicate with true on apply if item is buildable | [
"Can",
"be",
"useful",
"to",
"ignore",
"disabled",
"jobs",
"on",
"reregistering",
"hooks"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/util/JobInfoHelpers.java#L51-L57 |
116,408 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/util/JobInfoHelpers.java | JobInfoHelpers.isAlive | public static <ITEM extends Item> Predicate<ITEM> isAlive() {
return new Predicate<ITEM>() {
@Override
public boolean apply(ITEM item) {
return !from(GHEventsSubscriber.all()).filter(isApplicableFor(item)).toList().isEmpty();
}
};
} | java | public static <ITEM extends Item> Predicate<ITEM> isAlive() {
return new Predicate<ITEM>() {
@Override
public boolean apply(ITEM item) {
return !from(GHEventsSubscriber.all()).filter(isApplicableFor(item)).toList().isEmpty();
}
};
} | [
"public",
"static",
"<",
"ITEM",
"extends",
"Item",
">",
"Predicate",
"<",
"ITEM",
">",
"isAlive",
"(",
")",
"{",
"return",
"new",
"Predicate",
"<",
"ITEM",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"ITEM",
"item",
")",
... | If any of event subscriber interested in hook for item, then return true
By default, push hook subscriber is interested in job with gh-push-trigger
@return predicate with true if item alive and should have hook | [
"If",
"any",
"of",
"event",
"subscriber",
"interested",
"in",
"hook",
"for",
"item",
"then",
"return",
"true",
"By",
"default",
"push",
"hook",
"subscriber",
"is",
"interested",
"in",
"job",
"with",
"gh",
"-",
"push",
"-",
"trigger"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/util/JobInfoHelpers.java#L76-L83 |
116,409 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/util/XSSApi.java | XSSApi.asValidHref | public static String asValidHref(String urlString) {
try {
return new URL(urlString).toExternalForm();
} catch (MalformedURLException e) {
LOG.debug("Malformed url - {}, empty string will be returned", urlString);
return "";
}
} | java | public static String asValidHref(String urlString) {
try {
return new URL(urlString).toExternalForm();
} catch (MalformedURLException e) {
LOG.debug("Malformed url - {}, empty string will be returned", urlString);
return "";
}
} | [
"public",
"static",
"String",
"asValidHref",
"(",
"String",
"urlString",
")",
"{",
"try",
"{",
"return",
"new",
"URL",
"(",
"urlString",
")",
".",
"toExternalForm",
"(",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"LOG",
".",
"de... | Method to filter invalid url for XSS. This url can be inserted to href safely
@param urlString unsafe url
@return safe url | [
"Method",
"to",
"filter",
"invalid",
"url",
"for",
"XSS",
".",
"This",
"url",
"can",
"be",
"inserted",
"to",
"href",
"safely"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/util/XSSApi.java#L28-L35 |
116,410 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor.java | GitHubHookRegisterProblemMonitor.doAct | @RequirePOST
@RequireAdminRights
public HttpResponse doAct(StaplerRequest req) throws IOException {
if (req.hasParameter("no")) {
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
} else {
return new HttpRedirect(".");
}
} | java | @RequirePOST
@RequireAdminRights
public HttpResponse doAct(StaplerRequest req) throws IOException {
if (req.hasParameter("no")) {
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
} else {
return new HttpRedirect(".");
}
} | [
"@",
"RequirePOST",
"@",
"RequireAdminRights",
"public",
"HttpResponse",
"doAct",
"(",
"StaplerRequest",
"req",
")",
"throws",
"IOException",
"{",
"if",
"(",
"req",
".",
"hasParameter",
"(",
"\"no\"",
")",
")",
"{",
"disable",
"(",
"true",
")",
";",
"return"... | Depending on whether the user said "yes" or "no", send them to the right place. | [
"Depending",
"on",
"whether",
"the",
"user",
"said",
"yes",
"or",
"no",
"send",
"them",
"to",
"the",
"right",
"place",
"."
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/admin/GitHubHookRegisterProblemMonitor.java#L148-L157 |
116,411 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java | WebhookManager.unregisterFor | public void unregisterFor(GitHubRepositoryName name, List<GitHubRepositoryName> aliveRepos) {
try {
GHRepository repo = checkNotNull(
from(name.resolve(allowedToManageHooks())).firstMatch(withAdminAccess()).orNull(),
"There are no credentials with admin access... | java | public void unregisterFor(GitHubRepositoryName name, List<GitHubRepositoryName> aliveRepos) {
try {
GHRepository repo = checkNotNull(
from(name.resolve(allowedToManageHooks())).firstMatch(withAdminAccess()).orNull(),
"There are no credentials with admin access... | [
"public",
"void",
"unregisterFor",
"(",
"GitHubRepositoryName",
"name",
",",
"List",
"<",
"GitHubRepositoryName",
">",
"aliveRepos",
")",
"{",
"try",
"{",
"GHRepository",
"repo",
"=",
"checkNotNull",
"(",
"from",
"(",
"name",
".",
"resolve",
"(",
"allowedToManag... | Used to cleanup old hooks in case of removed or reconfigured trigger
since JENKINS-28138 this method permanently removes service hooks
So if the trigger for given name was only reconfigured, this method filters only service hooks
(with help of aliveRepos names list), otherwise this method removes all hooks for managed... | [
"Used",
"to",
"cleanup",
"old",
"hooks",
"in",
"case",
"of",
"removed",
"or",
"reconfigured",
"trigger",
"since",
"JENKINS",
"-",
"28138",
"this",
"method",
"permanently",
"removes",
"service",
"hooks"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java#L142-L164 |
116,412 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/status/sources/misc/BetterThanOrEqualBuildResult.java | BetterThanOrEqualBuildResult.betterThanOrEqualTo | public static BetterThanOrEqualBuildResult betterThanOrEqualTo(Result result, GHCommitState state, String msg) {
BetterThanOrEqualBuildResult conditional = new BetterThanOrEqualBuildResult();
conditional.setResult(result.toString());
conditional.setState(state.name());
conditional.setMes... | java | public static BetterThanOrEqualBuildResult betterThanOrEqualTo(Result result, GHCommitState state, String msg) {
BetterThanOrEqualBuildResult conditional = new BetterThanOrEqualBuildResult();
conditional.setResult(result.toString());
conditional.setState(state.name());
conditional.setMes... | [
"public",
"static",
"BetterThanOrEqualBuildResult",
"betterThanOrEqualTo",
"(",
"Result",
"result",
",",
"GHCommitState",
"state",
",",
"String",
"msg",
")",
"{",
"BetterThanOrEqualBuildResult",
"conditional",
"=",
"new",
"BetterThanOrEqualBuildResult",
"(",
")",
";",
"... | Convenient way to reuse logic of checking for the build status
@param result to check against
@param state state to set
@param msg message to set. Can contain env vars
@return new instance of this conditional result | [
"Convenient",
"way",
"to",
"reuse",
"logic",
"of",
"checking",
"for",
"the",
"build",
"status"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/status/sources/misc/BetterThanOrEqualBuildResult.java#L61-L67 |
116,413 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java | BuildDataHelper.calculateBuildData | public static BuildData calculateBuildData(
String parentName, String parentFullName, List<BuildData> buildDataList
) {
if (buildDataList == null) {
return null;
}
if (buildDataList.size() == 1) {
return buildDataList.get(0);
}
String projec... | java | public static BuildData calculateBuildData(
String parentName, String parentFullName, List<BuildData> buildDataList
) {
if (buildDataList == null) {
return null;
}
if (buildDataList.size() == 1) {
return buildDataList.get(0);
}
String projec... | [
"public",
"static",
"BuildData",
"calculateBuildData",
"(",
"String",
"parentName",
",",
"String",
"parentFullName",
",",
"List",
"<",
"BuildData",
">",
"buildDataList",
")",
"{",
"if",
"(",
"buildDataList",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
... | Calculate build data from downstream builds, that could be a shared library
which is loaded first in a pipeline. For that reason, this method compares
all remote URLs for each build data, with the real project name, to determine
the proper build data. This way, the SHA returned in the build data will
relate to the proj... | [
"Calculate",
"build",
"data",
"from",
"downstream",
"builds",
"that",
"could",
"be",
"a",
"shared",
"library",
"which",
"is",
"loaded",
"first",
"in",
"a",
"pipeline",
".",
"For",
"that",
"reason",
"this",
"method",
"compares",
"all",
"remote",
"URLs",
"for"... | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java#L37-L66 |
116,414 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/config/GitHubPluginConfig.java | GitHubPluginConfig.findGithubConfig | public Iterable<GitHub> findGithubConfig(Predicate<GitHubServerConfig> match) {
Function<GitHubServerConfig, GitHub> loginFunction = loginToGithub();
if (Objects.isNull(loginFunction)) {
return Collections.emptyList();
}
// try all the credentials since we don't know which o... | java | public Iterable<GitHub> findGithubConfig(Predicate<GitHubServerConfig> match) {
Function<GitHubServerConfig, GitHub> loginFunction = loginToGithub();
if (Objects.isNull(loginFunction)) {
return Collections.emptyList();
}
// try all the credentials since we don't know which o... | [
"public",
"Iterable",
"<",
"GitHub",
">",
"findGithubConfig",
"(",
"Predicate",
"<",
"GitHubServerConfig",
">",
"match",
")",
"{",
"Function",
"<",
"GitHubServerConfig",
",",
"GitHub",
">",
"loginFunction",
"=",
"loginToGithub",
"(",
")",
";",
"if",
"(",
"Obje... | Filters all stored configs against given predicate then
logs in as the given user and returns the non null connection objects | [
"Filters",
"all",
"stored",
"configs",
"against",
"given",
"predicate",
"then",
"logs",
"in",
"as",
"the",
"given",
"user",
"and",
"returns",
"the",
"non",
"null",
"connection",
"objects"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/config/GitHubPluginConfig.java#L134-L145 |
116,415 | jenkinsci/github-plugin | src/main/java/com/coravy/hudson/plugins/github/GithubUrl.java | GithubUrl.commitId | public String commitId(final String id) {
return new StringBuilder().append(baseUrl).append("commit/").append(id).toString();
} | java | public String commitId(final String id) {
return new StringBuilder().append(baseUrl).append("commit/").append(id).toString();
} | [
"public",
"String",
"commitId",
"(",
"final",
"String",
"id",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"baseUrl",
")",
".",
"append",
"(",
"\"commit/\"",
")",
".",
"append",
"(",
"id",
")",
".",
"toString",
"(",
")",
... | Returns the URL to a particular commit.
@param id - the git SHA1 hash
@return URL String (e.g. http://github.com/juretta/github-plugin/commit/5e31203faea681c41577b685818a361089fac1fc) | [
"Returns",
"the",
"URL",
"to",
"a",
"particular",
"commit",
"."
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/com/coravy/hudson/plugins/github/GithubUrl.java#L53-L55 |
116,416 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/common/ExpandableMessage.java | ExpandableMessage.expandAll | public String expandAll(Run<?, ?> run, TaskListener listener) throws IOException, InterruptedException {
if (run instanceof AbstractBuild) {
try {
return TokenMacro.expandAll(
(AbstractBuild) run,
listener,
conte... | java | public String expandAll(Run<?, ?> run, TaskListener listener) throws IOException, InterruptedException {
if (run instanceof AbstractBuild) {
try {
return TokenMacro.expandAll(
(AbstractBuild) run,
listener,
conte... | [
"public",
"String",
"expandAll",
"(",
"Run",
"<",
"?",
",",
"?",
">",
"run",
",",
"TaskListener",
"listener",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"run",
"instanceof",
"AbstractBuild",
")",
"{",
"try",
"{",
"return",
"... | Expands all env vars. In case of AbstractBuild also expands token macro and build vars
@param run build context
@param listener usually used to log something to console while building env vars
@return string with expanded vars and tokens | [
"Expands",
"all",
"env",
"vars",
".",
"In",
"case",
"of",
"AbstractBuild",
"also",
"expands",
"token",
"macro",
"and",
"build",
"vars"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/common/ExpandableMessage.java#L49-L69 |
116,417 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/status/sources/BuildRefBackrefSource.java | BuildRefBackrefSource.get | @SuppressWarnings("deprecation")
@Override
public String get(Run<?, ?> run, TaskListener listener) {
return DisplayURLProvider.get().getRunURL(run);
} | java | @SuppressWarnings("deprecation")
@Override
public String get(Run<?, ?> run, TaskListener listener) {
return DisplayURLProvider.get().getRunURL(run);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"@",
"Override",
"public",
"String",
"get",
"(",
"Run",
"<",
"?",
",",
"?",
">",
"run",
",",
"TaskListener",
"listener",
")",
"{",
"return",
"DisplayURLProvider",
".",
"get",
"(",
")",
".",
"getRunURL",... | Returns absolute URL of the Run | [
"Returns",
"absolute",
"URL",
"of",
"the",
"Run"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/status/sources/BuildRefBackrefSource.java#L26-L30 |
116,418 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriber.java | PingGHEventSubscriber.onEvent | @Override
protected void onEvent(GHEvent event, String payload) {
GHEventPayload.Ping ping;
try {
ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class);
} catch (IOException e) {
LOGGER.warn("Received malformed PingEvent: " + ... | java | @Override
protected void onEvent(GHEvent event, String payload) {
GHEventPayload.Ping ping;
try {
ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class);
} catch (IOException e) {
LOGGER.warn("Received malformed PingEvent: " + ... | [
"@",
"Override",
"protected",
"void",
"onEvent",
"(",
"GHEvent",
"event",
",",
"String",
"payload",
")",
"{",
"GHEventPayload",
".",
"Ping",
"ping",
";",
"try",
"{",
"ping",
"=",
"GitHub",
".",
"offline",
"(",
")",
".",
"parseEventPayload",
"(",
"new",
"... | Logs repo on ping event
@param event only PING event
@param payload payload of gh-event. Never blank | [
"Logs",
"repo",
"on",
"ping",
"event"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriber.java#L62-L83 |
116,419 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/internal/GitHubClientCacheOps.java | GitHubClientCacheOps.notInCaches | public static DirectoryStream.Filter<Path> notInCaches(Set<String> caches) {
checkNotNull(caches, "set of active caches can't be null");
return new NotInCachesFilter(caches);
} | java | public static DirectoryStream.Filter<Path> notInCaches(Set<String> caches) {
checkNotNull(caches, "set of active caches can't be null");
return new NotInCachesFilter(caches);
} | [
"public",
"static",
"DirectoryStream",
".",
"Filter",
"<",
"Path",
">",
"notInCaches",
"(",
"Set",
"<",
"String",
">",
"caches",
")",
"{",
"checkNotNull",
"(",
"caches",
",",
"\"set of active caches can't be null\"",
")",
";",
"return",
"new",
"NotInCachesFilter",... | To accept for cleaning only not active cache dirs
@param caches set of active cache names, extracted with help of {@link #cacheToName()}
@return filter to accept only names not in set | [
"To",
"accept",
"for",
"cleaning",
"only",
"not",
"active",
"cache",
"dirs"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/internal/GitHubClientCacheOps.java#L76-L79 |
116,420 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/internal/GitHubClientCacheOps.java | GitHubClientCacheOps.clearRedundantCaches | public static void clearRedundantCaches(List<GitHubServerConfig> configs) {
Path baseCacheDir = getBaseCacheDir();
if (notExists(baseCacheDir)) {
return;
}
final Set<String> actualNames = from(configs).filter(withEnabledCache()).transform(toCacheDir())
.tran... | java | public static void clearRedundantCaches(List<GitHubServerConfig> configs) {
Path baseCacheDir = getBaseCacheDir();
if (notExists(baseCacheDir)) {
return;
}
final Set<String> actualNames = from(configs).filter(withEnabledCache()).transform(toCacheDir())
.tran... | [
"public",
"static",
"void",
"clearRedundantCaches",
"(",
"List",
"<",
"GitHubServerConfig",
">",
"configs",
")",
"{",
"Path",
"baseCacheDir",
"=",
"getBaseCacheDir",
"(",
")",
";",
"if",
"(",
"notExists",
"(",
"baseCacheDir",
")",
")",
"{",
"return",
";",
"}... | Removes all not active dirs with old caches.
This method is invoked after each save of global plugin config
@param configs active server configs to exclude caches from cleanup | [
"Removes",
"all",
"not",
"active",
"dirs",
"with",
"old",
"caches",
".",
"This",
"method",
"is",
"invoked",
"after",
"each",
"save",
"of",
"global",
"plugin",
"config"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/internal/GitHubClientCacheOps.java#L97-L112 |
116,421 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/internal/GitHubClientCacheOps.java | GitHubClientCacheOps.deleteEveryIn | private static void deleteEveryIn(DirectoryStream<Path> caches) {
for (Path notActualCache : caches) {
LOGGER.debug("Deleting redundant cache dir {}", notActualCache);
try {
FileUtils.deleteDirectory(notActualCache.toFile());
} catch (IOException e) {
... | java | private static void deleteEveryIn(DirectoryStream<Path> caches) {
for (Path notActualCache : caches) {
LOGGER.debug("Deleting redundant cache dir {}", notActualCache);
try {
FileUtils.deleteDirectory(notActualCache.toFile());
} catch (IOException e) {
... | [
"private",
"static",
"void",
"deleteEveryIn",
"(",
"DirectoryStream",
"<",
"Path",
">",
"caches",
")",
"{",
"for",
"(",
"Path",
"notActualCache",
":",
"caches",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Deleting redundant cache dir {}\"",
",",
"notActualCache",
... | Removes directories with caches
@param caches paths to directories to be removed | [
"Removes",
"directories",
"with",
"caches"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/internal/GitHubClientCacheOps.java#L119-L128 |
116,422 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/GitHubPlugin.java | GitHubPlugin.runMigrator | @Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED, before = InitMilestone.JOB_LOADED)
public static void runMigrator() throws Exception {
new Migrator().migrate();
} | java | @Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED, before = InitMilestone.JOB_LOADED)
public static void runMigrator() throws Exception {
new Migrator().migrate();
} | [
"@",
"Initializer",
"(",
"after",
"=",
"InitMilestone",
".",
"EXTENSIONS_AUGMENTED",
",",
"before",
"=",
"InitMilestone",
".",
"JOB_LOADED",
")",
"public",
"static",
"void",
"runMigrator",
"(",
")",
"throws",
"Exception",
"{",
"new",
"Migrator",
"(",
")",
".",... | Launches migration after all extensions have been augmented as we need to ensure that the credentials plugin
has been initialized.
We need ensure that migrator will run after xstream aliases will be added.
@see <a href="https://issues.jenkins-ci.org/browse/JENKINS-36446">JENKINS-36446</a> | [
"Launches",
"migration",
"after",
"all",
"extensions",
"have",
"been",
"augmented",
"as",
"we",
"need",
"to",
"ensure",
"that",
"the",
"credentials",
"plugin",
"has",
"been",
"initialized",
".",
"We",
"need",
"ensure",
"that",
"migrator",
"will",
"run",
"after... | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/GitHubPlugin.java#L37-L40 |
116,423 | jenkinsci/github-plugin | src/main/java/org/jenkinsci/plugins/github/migration/Migrator.java | Migrator.toGHServerConfig | @VisibleForTesting
protected Function<Credential, GitHubServerConfig> toGHServerConfig() {
return new Function<Credential, GitHubServerConfig>() {
@Override
public GitHubServerConfig apply(Credential input) {
LOGGER.info("Migrate GitHub Plugin creds for {} {}", input.... | java | @VisibleForTesting
protected Function<Credential, GitHubServerConfig> toGHServerConfig() {
return new Function<Credential, GitHubServerConfig>() {
@Override
public GitHubServerConfig apply(Credential input) {
LOGGER.info("Migrate GitHub Plugin creds for {} {}", input.... | [
"@",
"VisibleForTesting",
"protected",
"Function",
"<",
"Credential",
",",
"GitHubServerConfig",
">",
"toGHServerConfig",
"(",
")",
"{",
"return",
"new",
"Function",
"<",
"Credential",
",",
"GitHubServerConfig",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Gi... | Creates new string credentials from token
@return converter to get all useful info from old plain creds and crete new server config | [
"Creates",
"new",
"string",
"credentials",
"from",
"token"
] | 4e05b9aeb488af5342c78f78aa3c55114e8d462a | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/migration/Migrator.java#L69-L90 |
116,424 | alphamu/PinEntryEditText | pinentryedittext/src/main/java/com/alimuzaffar/lib/pin/PinEntryEditText.java | PinEntryEditText.focus | public void focus() {
requestFocus();
// Show keyboard
InputMethodManager inputMethodManager = (InputMethodManager) getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(this, 0);
} | java | public void focus() {
requestFocus();
// Show keyboard
InputMethodManager inputMethodManager = (InputMethodManager) getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(this, 0);
} | [
"public",
"void",
"focus",
"(",
")",
"{",
"requestFocus",
"(",
")",
";",
"// Show keyboard",
"InputMethodManager",
"inputMethodManager",
"=",
"(",
"InputMethodManager",
")",
"getContext",
"(",
")",
".",
"getSystemService",
"(",
"Context",
".",
"INPUT_METHOD_SERVICE"... | Request focus on this PinEntryEditText | [
"Request",
"focus",
"on",
"this",
"PinEntryEditText"
] | bb458aaacb019043a07537e43e12eaed1b402c2b | https://github.com/alphamu/PinEntryEditText/blob/bb458aaacb019043a07537e43e12eaed1b402c2b/pinentryedittext/src/main/java/com/alimuzaffar/lib/pin/PinEntryEditText.java#L468-L475 |
116,425 | k0shk0sh/PermissionHelper | permission/src/main/java/com/fastaccess/permission/base/PermissionFragmentHelper.java | PermissionFragmentHelper.openSettingsScreen | public void openSettingsScreen() {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.parse("package:" + context.getContext().getPackageName());
intent.setData(uri);
context.startActivity(intent);
} | java | public void openSettingsScreen() {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.parse("package:" + context.getContext().getPackageName());
intent.setData(uri);
context.startActivity(intent);
} | [
"public",
"void",
"openSettingsScreen",
"(",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
")",
";",
"intent",
".",
"setAction",
"(",
"Settings",
".",
"ACTION_APPLICATION_DETAILS_SETTINGS",
")",
";",
"Uri",
"uri",
"=",
"Uri",
".",
"parse",
"(",
... | open android settings screen for the specific package name | [
"open",
"android",
"settings",
"screen",
"for",
"the",
"specific",
"package",
"name"
] | 04edce2af49981d1dd321bcdfbe981a1000b29d7 | https://github.com/k0shk0sh/PermissionHelper/blob/04edce2af49981d1dd321bcdfbe981a1000b29d7/permission/src/main/java/com/fastaccess/permission/base/PermissionFragmentHelper.java#L289-L295 |
116,426 | k0shk0sh/PermissionHelper | permission/src/main/java/com/fastaccess/permission/base/activity/BasePermissionActivity.java | BasePermissionActivity.requestPermission | protected void requestPermission(final PermissionModel model) {
new AlertDialog.Builder(this)
.setTitle(model.getTitle())
.setMessage(model.getExplanationMessage())
.setPositiveButton("Request", new DialogInterface.OnClickListener() {
@Override... | java | protected void requestPermission(final PermissionModel model) {
new AlertDialog.Builder(this)
.setTitle(model.getTitle())
.setMessage(model.getExplanationMessage())
.setPositiveButton("Request", new DialogInterface.OnClickListener() {
@Override... | [
"protected",
"void",
"requestPermission",
"(",
"final",
"PermissionModel",
"model",
")",
"{",
"new",
"AlertDialog",
".",
"Builder",
"(",
"this",
")",
".",
"setTitle",
"(",
"model",
".",
"getTitle",
"(",
")",
")",
".",
"setMessage",
"(",
"model",
".",
"getE... | internal usage to show dialog with explanation you provided and a button to ask the user to request the permission | [
"internal",
"usage",
"to",
"show",
"dialog",
"with",
"explanation",
"you",
"provided",
"and",
"a",
"button",
"to",
"ask",
"the",
"user",
"to",
"request",
"the",
"permission"
] | 04edce2af49981d1dd321bcdfbe981a1000b29d7 | https://github.com/k0shk0sh/PermissionHelper/blob/04edce2af49981d1dd321bcdfbe981a1000b29d7/permission/src/main/java/com/fastaccess/permission/base/activity/BasePermissionActivity.java#L257-L271 |
116,427 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/SegmentIntegration.java | SegmentIntegration.performFlush | void performFlush() {
// Conditions could have changed between enqueuing the task and when it is run.
if (!shouldFlush()) {
return;
}
logger.verbose("Uploading payloads in queue to Segment.");
int payloadsUploaded = 0;
Client.Connection connection = null;
try {
// Open a connect... | java | void performFlush() {
// Conditions could have changed between enqueuing the task and when it is run.
if (!shouldFlush()) {
return;
}
logger.verbose("Uploading payloads in queue to Segment.");
int payloadsUploaded = 0;
Client.Connection connection = null;
try {
// Open a connect... | [
"void",
"performFlush",
"(",
")",
"{",
"// Conditions could have changed between enqueuing the task and when it is run.",
"if",
"(",
"!",
"shouldFlush",
"(",
")",
")",
"{",
"return",
";",
"}",
"logger",
".",
"verbose",
"(",
"\"Uploading payloads in queue to Segment.\"",
"... | Upload payloads to our servers and remove them from the queue file. | [
"Upload",
"payloads",
"to",
"our",
"servers",
"and",
"remove",
"them",
"from",
"the",
"queue",
"file",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/SegmentIntegration.java#L353-L413 |
116,428 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/integrations/BasePayload.java | BasePayload.timestamp | @Nullable
public Date timestamp() {
// It's unclear if this will ever be null. So we're being safe.
String timestamp = getString(TIMESTAMP_KEY);
if (isNullOrEmpty(timestamp)) {
return null;
}
return parseISO8601Date(timestamp);
} | java | @Nullable
public Date timestamp() {
// It's unclear if this will ever be null. So we're being safe.
String timestamp = getString(TIMESTAMP_KEY);
if (isNullOrEmpty(timestamp)) {
return null;
}
return parseISO8601Date(timestamp);
} | [
"@",
"Nullable",
"public",
"Date",
"timestamp",
"(",
")",
"{",
"// It's unclear if this will ever be null. So we're being safe.",
"String",
"timestamp",
"=",
"getString",
"(",
"TIMESTAMP_KEY",
")",
";",
"if",
"(",
"isNullOrEmpty",
"(",
"timestamp",
")",
")",
"{",
"r... | Set a timestamp the event occurred.
<p>This library will automatically create and attach a timestamp to all events.
@see <a href="https://segment.com/docs/spec/common/#timestamps">Timestamp</a> | [
"Set",
"a",
"timestamp",
"the",
"event",
"occurred",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/integrations/BasePayload.java#L120-L128 |
116,429 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Traits.java | Traits.create | static Traits create() {
Traits traits = new Traits(new NullableConcurrentHashMap<String, Object>());
traits.putAnonymousId(UUID.randomUUID().toString());
return traits;
} | java | static Traits create() {
Traits traits = new Traits(new NullableConcurrentHashMap<String, Object>());
traits.putAnonymousId(UUID.randomUUID().toString());
return traits;
} | [
"static",
"Traits",
"create",
"(",
")",
"{",
"Traits",
"traits",
"=",
"new",
"Traits",
"(",
"new",
"NullableConcurrentHashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
")",
";",
"traits",
".",
"putAnonymousId",
"(",
"UUID",
".",
"randomUUID",
"(",
"... | Create a new Traits instance with an anonymous ID. Analytics client can be called on any
thread, so this instance is thread safe. | [
"Create",
"a",
"new",
"Traits",
"instance",
"with",
"an",
"anonymous",
"ID",
".",
"Analytics",
"client",
"can",
"be",
"called",
"on",
"any",
"thread",
"so",
"this",
"instance",
"is",
"thread",
"safe",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Traits.java#L79-L83 |
116,430 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/ValueMap.java | ValueMap.putValue | public ValueMap putValue(String key, Object value) {
delegate.put(key, value);
return this;
} | java | public ValueMap putValue(String key, Object value) {
delegate.put(key, value);
return this;
} | [
"public",
"ValueMap",
"putValue",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"delegate",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Helper method to be able to chain put methods. | [
"Helper",
"method",
"to",
"be",
"able",
"to",
"chain",
"put",
"methods",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/ValueMap.java#L166-L169 |
116,431 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/integrations/ScreenPayload.java | ScreenPayload.event | @NonNull
public String event() {
String name = name();
if (!isNullOrEmpty(name)) {
return name;
}
return category();
} | java | @NonNull
public String event() {
String name = name();
if (!isNullOrEmpty(name)) {
return name;
}
return category();
} | [
"@",
"NonNull",
"public",
"String",
"event",
"(",
")",
"{",
"String",
"name",
"=",
"name",
"(",
")",
";",
"if",
"(",
"!",
"isNullOrEmpty",
"(",
"name",
")",
")",
"{",
"return",
"name",
";",
"}",
"return",
"category",
"(",
")",
";",
"}"
] | Either the name or category of the screen payload. | [
"Either",
"the",
"name",
"or",
"category",
"of",
"the",
"screen",
"payload",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/integrations/ScreenPayload.java#L79-L86 |
116,432 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Options.java | Options.setIntegration | public Options setIntegration(String integrationKey, boolean enabled) {
if (SegmentIntegration.SEGMENT_KEY.equals(integrationKey)) {
throw new IllegalArgumentException("Segment integration cannot be enabled or disabled.");
}
integrations.put(integrationKey, enabled);
return this;
} | java | public Options setIntegration(String integrationKey, boolean enabled) {
if (SegmentIntegration.SEGMENT_KEY.equals(integrationKey)) {
throw new IllegalArgumentException("Segment integration cannot be enabled or disabled.");
}
integrations.put(integrationKey, enabled);
return this;
} | [
"public",
"Options",
"setIntegration",
"(",
"String",
"integrationKey",
",",
"boolean",
"enabled",
")",
"{",
"if",
"(",
"SegmentIntegration",
".",
"SEGMENT_KEY",
".",
"equals",
"(",
"integrationKey",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Sets whether an action will be sent to the target integration.
<p>By default, all integrations are sent a payload, and the value for the {@link
#ALL_INTEGRATIONS_KEY} is {@code true}. You can disable specific payloads.
<p>Example: <code>options.setIntegration("Google Analytics", false).setIntegration("Countly",
false... | [
"Sets",
"whether",
"an",
"action",
"will",
"be",
"sent",
"to",
"the",
"target",
"integration",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Options.java#L71-L77 |
116,433 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Options.java | Options.setIntegrationOptions | public Options setIntegrationOptions(String integrationKey, Map<String, Object> options) {
integrations.put(integrationKey, options);
return this;
} | java | public Options setIntegrationOptions(String integrationKey, Map<String, Object> options) {
integrations.put(integrationKey, options);
return this;
} | [
"public",
"Options",
"setIntegrationOptions",
"(",
"String",
"integrationKey",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
")",
"{",
"integrations",
".",
"put",
"(",
"integrationKey",
",",
"options",
")",
";",
"return",
"this",
";",
"}"
] | Attach some integration specific options for this call.
@param integrationKey The target integration key
@param options A map of data that will be used by the integration
@return This options object for chaining | [
"Attach",
"some",
"integration",
"specific",
"options",
"for",
"this",
"call",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Options.java#L100-L103 |
116,434 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.newSet | public static <T> Set<T> newSet(T... values) {
Set<T> set = new HashSet<>(values.length);
Collections.addAll(set, values);
return set;
} | java | public static <T> Set<T> newSet(T... values) {
Set<T> set = new HashSet<>(values.length);
Collections.addAll(set, values);
return set;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"newSet",
"(",
"T",
"...",
"values",
")",
"{",
"Set",
"<",
"T",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
"values",
".",
"length",
")",
";",
"Collections",
".",
"addAll",
"(",
"set",
... | Creates a mutable HashSet instance containing the given elements in unspecified order | [
"Creates",
"a",
"mutable",
"HashSet",
"instance",
"containing",
"the",
"given",
"elements",
"in",
"unspecified",
"order"
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L85-L89 |
116,435 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.getDeviceId | @SuppressLint("HardwareIds")
public static String getDeviceId(Context context) {
String androidId = getString(context.getContentResolver(), ANDROID_ID);
if (!isNullOrEmpty(androidId)
&& !"9774d56d682e549c".equals(androidId)
&& !"unknown".equals(androidId)
&& !"000000000000000".equals(a... | java | @SuppressLint("HardwareIds")
public static String getDeviceId(Context context) {
String androidId = getString(context.getContentResolver(), ANDROID_ID);
if (!isNullOrEmpty(androidId)
&& !"9774d56d682e549c".equals(androidId)
&& !"unknown".equals(androidId)
&& !"000000000000000".equals(a... | [
"@",
"SuppressLint",
"(",
"\"HardwareIds\"",
")",
"public",
"static",
"String",
"getDeviceId",
"(",
"Context",
"context",
")",
"{",
"String",
"androidId",
"=",
"getString",
"(",
"context",
".",
"getContentResolver",
"(",
")",
",",
"ANDROID_ID",
")",
";",
"if",... | Creates a unique device id. Suppresses `HardwareIds` lint warnings as we don't use this ID for
identifying specific users. This is also what is required by the Segment spec. | [
"Creates",
"a",
"unique",
"device",
"id",
".",
"Suppresses",
"HardwareIds",
"lint",
"warnings",
"as",
"we",
"don",
"t",
"use",
"this",
"ID",
"for",
"identifying",
"specific",
"users",
".",
"This",
"is",
"also",
"what",
"is",
"required",
"by",
"the",
"Segme... | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L254-L281 |
116,436 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.getSegmentSharedPreferences | public static SharedPreferences getSegmentSharedPreferences(Context context, String tag) {
return context.getSharedPreferences("analytics-android-" + tag, MODE_PRIVATE);
} | java | public static SharedPreferences getSegmentSharedPreferences(Context context, String tag) {
return context.getSharedPreferences("analytics-android-" + tag, MODE_PRIVATE);
} | [
"public",
"static",
"SharedPreferences",
"getSegmentSharedPreferences",
"(",
"Context",
"context",
",",
"String",
"tag",
")",
"{",
"return",
"context",
".",
"getSharedPreferences",
"(",
"\"analytics-android-\"",
"+",
"tag",
",",
"MODE_PRIVATE",
")",
";",
"}"
] | Returns a shared preferences for storing any library preferences. | [
"Returns",
"a",
"shared",
"preferences",
"for",
"storing",
"any",
"library",
"preferences",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L284-L286 |
116,437 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.getResourceString | public static String getResourceString(Context context, String key) {
int id = getIdentifier(context, "string", key);
if (id != 0) {
return context.getResources().getString(id);
} else {
return null;
}
} | java | public static String getResourceString(Context context, String key) {
int id = getIdentifier(context, "string", key);
if (id != 0) {
return context.getResources().getString(id);
} else {
return null;
}
} | [
"public",
"static",
"String",
"getResourceString",
"(",
"Context",
"context",
",",
"String",
"key",
")",
"{",
"int",
"id",
"=",
"getIdentifier",
"(",
"context",
",",
"\"string\"",
",",
"key",
")",
";",
"if",
"(",
"id",
"!=",
"0",
")",
"{",
"return",
"c... | Get the string resource for the given key. Returns null if not found. | [
"Get",
"the",
"string",
"resource",
"for",
"the",
"given",
"key",
".",
"Returns",
"null",
"if",
"not",
"found",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L289-L296 |
116,438 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.getIdentifier | private static int getIdentifier(Context context, String type, String key) {
return context.getResources().getIdentifier(key, type, context.getPackageName());
} | java | private static int getIdentifier(Context context, String type, String key) {
return context.getResources().getIdentifier(key, type, context.getPackageName());
} | [
"private",
"static",
"int",
"getIdentifier",
"(",
"Context",
"context",
",",
"String",
"type",
",",
"String",
"key",
")",
"{",
"return",
"context",
".",
"getResources",
"(",
")",
".",
"getIdentifier",
"(",
"key",
",",
"type",
",",
"context",
".",
"getPacka... | Get the identifier for the resource with a given type and key. | [
"Get",
"the",
"identifier",
"for",
"the",
"resource",
"with",
"a",
"given",
"type",
"and",
"key",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L299-L301 |
116,439 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.createDirectory | public static void createDirectory(File location) throws IOException {
if (!(location.exists() || location.mkdirs() || location.isDirectory())) {
throw new IOException("Could not create directory at " + location);
}
} | java | public static void createDirectory(File location) throws IOException {
if (!(location.exists() || location.mkdirs() || location.isDirectory())) {
throw new IOException("Could not create directory at " + location);
}
} | [
"public",
"static",
"void",
"createDirectory",
"(",
"File",
"location",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"(",
"location",
".",
"exists",
"(",
")",
"||",
"location",
".",
"mkdirs",
"(",
")",
"||",
"location",
".",
"isDirectory",
"(",
")"... | Ensures that a directory is created in the given location, throws an IOException otherwise. | [
"Ensures",
"that",
"a",
"directory",
"is",
"created",
"in",
"the",
"given",
"location",
"throws",
"an",
"IOException",
"otherwise",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L475-L479 |
116,440 | segmentio/analytics-android | analytics-wear/src/main/java/com/segment/analytics/WearAnalytics.java | WearAnalytics.screen | public void screen(String category, String name, Properties properties) {
if (isNullOrEmpty(category) && isNullOrEmpty(name)) {
throw new IllegalArgumentException("either category or name must be provided.");
}
if (properties == null) {
properties = new Properties();
}
dispatcher.dispa... | java | public void screen(String category, String name, Properties properties) {
if (isNullOrEmpty(category) && isNullOrEmpty(name)) {
throw new IllegalArgumentException("either category or name must be provided.");
}
if (properties == null) {
properties = new Properties();
}
dispatcher.dispa... | [
"public",
"void",
"screen",
"(",
"String",
"category",
",",
"String",
"name",
",",
"Properties",
"properties",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"category",
")",
"&&",
"isNullOrEmpty",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExce... | The screen methods let your record whenever a user sees a screen of your mobile app, and attach
a name, category or properties to the screen.
<p>Either category or name must be provided.
@param category A category to describe the screen
@param name A name for the screen
@param properties {@link Properties} to add ext... | [
"The",
"screen",
"methods",
"let",
"your",
"record",
"whenever",
"a",
"user",
"sees",
"a",
"screen",
"of",
"your",
"mobile",
"app",
"and",
"attach",
"a",
"name",
"category",
"or",
"properties",
"to",
"the",
"screen",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics-wear/src/main/java/com/segment/analytics/WearAnalytics.java#L99-L111 |
116,441 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Cartographer.java | Cartographer.listToWriter | private static void listToWriter(List<?> list, JsonWriter writer) throws IOException {
writer.beginArray();
for (Object value : list) {
writeValue(value, writer);
}
writer.endArray();
} | java | private static void listToWriter(List<?> list, JsonWriter writer) throws IOException {
writer.beginArray();
for (Object value : list) {
writeValue(value, writer);
}
writer.endArray();
} | [
"private",
"static",
"void",
"listToWriter",
"(",
"List",
"<",
"?",
">",
"list",
",",
"JsonWriter",
"writer",
")",
"throws",
"IOException",
"{",
"writer",
".",
"beginArray",
"(",
")",
";",
"for",
"(",
"Object",
"value",
":",
"list",
")",
"{",
"writeValue... | Print the json representation of a List to the given writer. | [
"Print",
"the",
"json",
"representation",
"of",
"a",
"List",
"to",
"the",
"given",
"writer",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Cartographer.java#L185-L191 |
116,442 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/integrations/Logger.java | Logger.verbose | public void verbose(String format, Object... extra) {
if (shouldLog(VERBOSE)) {
Log.v(tag, String.format(format, extra));
}
} | java | public void verbose(String format, Object... extra) {
if (shouldLog(VERBOSE)) {
Log.v(tag, String.format(format, extra));
}
} | [
"public",
"void",
"verbose",
"(",
"String",
"format",
",",
"Object",
"...",
"extra",
")",
"{",
"if",
"(",
"shouldLog",
"(",
"VERBOSE",
")",
")",
"{",
"Log",
".",
"v",
"(",
"tag",
",",
"String",
".",
"format",
"(",
"format",
",",
"extra",
")",
")",
... | Log a verbose message. | [
"Log",
"a",
"verbose",
"message",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/integrations/Logger.java#L45-L49 |
116,443 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/integrations/Logger.java | Logger.info | public void info(String format, Object... extra) {
if (shouldLog(INFO)) {
Log.i(tag, String.format(format, extra));
}
} | java | public void info(String format, Object... extra) {
if (shouldLog(INFO)) {
Log.i(tag, String.format(format, extra));
}
} | [
"public",
"void",
"info",
"(",
"String",
"format",
",",
"Object",
"...",
"extra",
")",
"{",
"if",
"(",
"shouldLog",
"(",
"INFO",
")",
")",
"{",
"Log",
".",
"i",
"(",
"tag",
",",
"String",
".",
"format",
"(",
"format",
",",
"extra",
")",
")",
";",... | Log an info message. | [
"Log",
"an",
"info",
"message",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/integrations/Logger.java#L52-L56 |
116,444 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/integrations/Logger.java | Logger.debug | public void debug(String format, Object... extra) {
if (shouldLog(DEBUG)) {
Log.d(tag, String.format(format, extra));
}
} | java | public void debug(String format, Object... extra) {
if (shouldLog(DEBUG)) {
Log.d(tag, String.format(format, extra));
}
} | [
"public",
"void",
"debug",
"(",
"String",
"format",
",",
"Object",
"...",
"extra",
")",
"{",
"if",
"(",
"shouldLog",
"(",
"DEBUG",
")",
")",
"{",
"Log",
".",
"d",
"(",
"tag",
",",
"String",
".",
"format",
"(",
"format",
",",
"extra",
")",
")",
";... | Log a debug message. | [
"Log",
"a",
"debug",
"message",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/integrations/Logger.java#L59-L63 |
116,445 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/AnalyticsContext.java | AnalyticsContext.unmodifiableCopy | public AnalyticsContext unmodifiableCopy() {
LinkedHashMap<String, Object> map = new LinkedHashMap<>(this);
return new AnalyticsContext(unmodifiableMap(map));
} | java | public AnalyticsContext unmodifiableCopy() {
LinkedHashMap<String, Object> map = new LinkedHashMap<>(this);
return new AnalyticsContext(unmodifiableMap(map));
} | [
"public",
"AnalyticsContext",
"unmodifiableCopy",
"(",
")",
"{",
"LinkedHashMap",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
"this",
")",
";",
"return",
"new",
"AnalyticsContext",
"(",
"unmodifiableMap",
"(",
"map",
")",
... | Returns an unmodifiable shallow copy of the values in this map. | [
"Returns",
"an",
"unmodifiable",
"shallow",
"copy",
"of",
"the",
"values",
"in",
"this",
"map",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/AnalyticsContext.java#L174-L177 |
116,446 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/AnalyticsContext.java | AnalyticsContext.putLibrary | void putLibrary() {
Map<String, Object> library = createMap();
library.put(LIBRARY_NAME_KEY, "analytics-android");
library.put(LIBRARY_VERSION_KEY, BuildConfig.VERSION_NAME);
put(LIBRARY_KEY, library);
} | java | void putLibrary() {
Map<String, Object> library = createMap();
library.put(LIBRARY_NAME_KEY, "analytics-android");
library.put(LIBRARY_VERSION_KEY, BuildConfig.VERSION_NAME);
put(LIBRARY_KEY, library);
} | [
"void",
"putLibrary",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"library",
"=",
"createMap",
"(",
")",
";",
"library",
".",
"put",
"(",
"LIBRARY_NAME_KEY",
",",
"\"analytics-android\"",
")",
";",
"library",
".",
"put",
"(",
"LIBRARY_VERSION_... | Fill this instance with library information. | [
"Fill",
"this",
"instance",
"with",
"library",
"information",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/AnalyticsContext.java#L249-L254 |
116,447 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/AnalyticsContext.java | AnalyticsContext.putOs | void putOs() {
Map<String, Object> os = createMap();
os.put(OS_NAME_KEY, "Android");
os.put(OS_VERSION_KEY, Build.VERSION.RELEASE);
put(OS_KEY, os);
} | java | void putOs() {
Map<String, Object> os = createMap();
os.put(OS_NAME_KEY, "Android");
os.put(OS_VERSION_KEY, Build.VERSION.RELEASE);
put(OS_KEY, os);
} | [
"void",
"putOs",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"os",
"=",
"createMap",
"(",
")",
";",
"os",
".",
"put",
"(",
"OS_NAME_KEY",
",",
"\"Android\"",
")",
";",
"os",
".",
"put",
"(",
"OS_VERSION_KEY",
",",
"Build",
".",
"VERSIO... | Fill this instance with operating system information. | [
"Fill",
"this",
"instance",
"with",
"operating",
"system",
"information",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/AnalyticsContext.java#L295-L300 |
116,448 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/QueueFile.java | QueueFile.add | public synchronized void add(byte[] data, int offset, int count) throws IOException {
if (data == null) {
throw new NullPointerException("data == null");
}
if ((offset | count) < 0 || count > data.length - offset) {
throw new IndexOutOfBoundsException();
}
expandIfNecessary(count);
... | java | public synchronized void add(byte[] data, int offset, int count) throws IOException {
if (data == null) {
throw new NullPointerException("data == null");
}
if ((offset | count) < 0 || count > data.length - offset) {
throw new IndexOutOfBoundsException();
}
expandIfNecessary(count);
... | [
"public",
"synchronized",
"void",
"add",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"count",
")",
"throws",
"IOException",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"data == null\""... | Adds an element to the end of the queue.
@param data to copy bytes from
@param offset to start from in buffer
@param count number of bytes to copy
@throws IndexOutOfBoundsException if {@code offset < 0} or {@code count < 0}, or if {@code
offset + count} is bigger than the length of {@code buffer}. | [
"Adds",
"an",
"element",
"to",
"the",
"end",
"of",
"the",
"queue",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/QueueFile.java#L300-L331 |
116,449 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Analytics.java | Analytics.group | public void group(
@NonNull final String groupId,
@Nullable final Traits groupTraits,
@Nullable final Options options) {
assertNotShutdown();
if (isNullOrEmpty(groupId)) {
throw new IllegalArgumentException("groupId must not be null or empty.");
}
analyticsExecutor.submit(
... | java | public void group(
@NonNull final String groupId,
@Nullable final Traits groupTraits,
@Nullable final Options options) {
assertNotShutdown();
if (isNullOrEmpty(groupId)) {
throw new IllegalArgumentException("groupId must not be null or empty.");
}
analyticsExecutor.submit(
... | [
"public",
"void",
"group",
"(",
"@",
"NonNull",
"final",
"String",
"groupId",
",",
"@",
"Nullable",
"final",
"Traits",
"groupTraits",
",",
"@",
"Nullable",
"final",
"Options",
"options",
")",
"{",
"assertNotShutdown",
"(",
")",
";",
"if",
"(",
"isNullOrEmpty... | The group method lets you associate a user with a group. It also lets you record custom traits
about the group, like industry or number of employees.
<p>If you've called {@link #identify(String, Traits, Options)} before, this will automatically
remember the userId. If not, it will fall back to use the anonymousId inst... | [
"The",
"group",
"method",
"lets",
"you",
"associate",
"a",
"user",
"with",
"a",
"group",
".",
"It",
"also",
"lets",
"you",
"record",
"custom",
"traits",
"about",
"the",
"group",
"like",
"industry",
"or",
"number",
"of",
"employees",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Analytics.java#L553-L585 |
116,450 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Analytics.java | Analytics.screen | public void screen(
@Nullable final String category,
@Nullable final String name,
@Nullable final Properties properties,
@Nullable final Options options) {
assertNotShutdown();
if (isNullOrEmpty(category) && isNullOrEmpty(name)) {
throw new IllegalArgumentException("either category... | java | public void screen(
@Nullable final String category,
@Nullable final String name,
@Nullable final Properties properties,
@Nullable final Options options) {
assertNotShutdown();
if (isNullOrEmpty(category) && isNullOrEmpty(name)) {
throw new IllegalArgumentException("either category... | [
"public",
"void",
"screen",
"(",
"@",
"Nullable",
"final",
"String",
"category",
",",
"@",
"Nullable",
"final",
"String",
"name",
",",
"@",
"Nullable",
"final",
"Properties",
"properties",
",",
"@",
"Nullable",
"final",
"Options",
"options",
")",
"{",
"asser... | The screen methods let your record whenever a user sees a screen of your mobile app, and attach
a name, category or properties to the screen. Either category or name must be provided.
@param category A category to describe the screen. Deprecated.
@param name A name for the screen.
@param properties {@link Properties} ... | [
"The",
"screen",
"methods",
"let",
"your",
"record",
"whenever",
"a",
"user",
"sees",
"a",
"screen",
"of",
"your",
"mobile",
"app",
"and",
"attach",
"a",
"name",
"category",
"or",
"properties",
"to",
"the",
"screen",
".",
"Either",
"category",
"or",
"name"... | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Analytics.java#L679-L716 |
116,451 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Analytics.java | Analytics.alias | public void alias(final @NonNull String newId, final @Nullable Options options) {
assertNotShutdown();
if (isNullOrEmpty(newId)) {
throw new IllegalArgumentException("newId must not be null or empty.");
}
analyticsExecutor.submit(
new Runnable() {
@Override
public void... | java | public void alias(final @NonNull String newId, final @Nullable Options options) {
assertNotShutdown();
if (isNullOrEmpty(newId)) {
throw new IllegalArgumentException("newId must not be null or empty.");
}
analyticsExecutor.submit(
new Runnable() {
@Override
public void... | [
"public",
"void",
"alias",
"(",
"final",
"@",
"NonNull",
"String",
"newId",
",",
"final",
"@",
"Nullable",
"Options",
"options",
")",
"{",
"assertNotShutdown",
"(",
")",
";",
"if",
"(",
"isNullOrEmpty",
"(",
"newId",
")",
")",
"{",
"throw",
"new",
"Illeg... | The alias method is used to merge two user identities, effectively connecting two sets of user
data as one. This is an advanced method, but it is required to manage user identities
successfully in some of our integrations.
<p>Usage:
<pre> <code>
analytics.track("user did something");
analytics.alias(newId);
analytics... | [
"The",
"alias",
"method",
"is",
"used",
"to",
"merge",
"two",
"user",
"identities",
"effectively",
"connecting",
"two",
"sets",
"of",
"user",
"data",
"as",
"one",
".",
"This",
"is",
"an",
"advanced",
"method",
"but",
"it",
"is",
"required",
"to",
"manage",... | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Analytics.java#L742-L766 |
116,452 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Analytics.java | Analytics.reset | public void reset() {
Utils.getSegmentSharedPreferences(application, tag).edit().clear().apply();
traitsCache.delete();
traitsCache.set(Traits.create());
analyticsContext.setTraits(traitsCache.get());
runOnMainThread(IntegrationOperation.RESET);
} | java | public void reset() {
Utils.getSegmentSharedPreferences(application, tag).edit().clear().apply();
traitsCache.delete();
traitsCache.set(Traits.create());
analyticsContext.setTraits(traitsCache.get());
runOnMainThread(IntegrationOperation.RESET);
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"Utils",
".",
"getSegmentSharedPreferences",
"(",
"application",
",",
"tag",
")",
".",
"edit",
"(",
")",
".",
"clear",
"(",
")",
".",
"apply",
"(",
")",
";",
"traitsCache",
".",
"delete",
"(",
")",
";",
"trai... | Resets the analytics client by clearing any stored information about the user. Events queued on
disk are not cleared, and will be uploaded at a later time. | [
"Resets",
"the",
"analytics",
"client",
"by",
"clearing",
"any",
"stored",
"information",
"about",
"the",
"user",
".",
"Events",
"queued",
"on",
"disk",
"are",
"not",
"cleared",
"and",
"will",
"be",
"uploaded",
"at",
"a",
"later",
"time",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Analytics.java#L907-L913 |
116,453 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Analytics.java | Analytics.onIntegrationReady | public <T> void onIntegrationReady(final String key, final Callback<T> callback) {
if (isNullOrEmpty(key)) {
throw new IllegalArgumentException("key cannot be null or empty.");
}
analyticsExecutor.submit(
new Runnable() {
@Override
public void run() {
HANDLER.p... | java | public <T> void onIntegrationReady(final String key, final Callback<T> callback) {
if (isNullOrEmpty(key)) {
throw new IllegalArgumentException("key cannot be null or empty.");
}
analyticsExecutor.submit(
new Runnable() {
@Override
public void run() {
HANDLER.p... | [
"public",
"<",
"T",
">",
"void",
"onIntegrationReady",
"(",
"final",
"String",
"key",
",",
"final",
"Callback",
"<",
"T",
">",
"callback",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"key",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"... | Register to be notified when a bundled integration is ready.
<p>In most cases, integrations would have already been initialized, and the callback will be
invoked fairly quickly. However there may be a latency the first time the app is launched, and
we don't have settings for bundled integrations yet. This is compounde... | [
"Register",
"to",
"be",
"notified",
"when",
"a",
"bundled",
"integration",
"is",
"ready",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Analytics.java#L950-L968 |
116,454 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Analytics.java | Analytics.performRun | void performRun(IntegrationOperation operation) {
for (Map.Entry<String, Integration<?>> entry : integrations.entrySet()) {
String key = entry.getKey();
long startTime = System.nanoTime();
operation.run(key, entry.getValue(), projectSettings);
long endTime = System.nanoTime();
long dur... | java | void performRun(IntegrationOperation operation) {
for (Map.Entry<String, Integration<?>> entry : integrations.entrySet()) {
String key = entry.getKey();
long startTime = System.nanoTime();
operation.run(key, entry.getValue(), projectSettings);
long endTime = System.nanoTime();
long dur... | [
"void",
"performRun",
"(",
"IntegrationOperation",
"operation",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integration",
"<",
"?",
">",
">",
"entry",
":",
"integrations",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"... | Runs the given operation on all integrations. | [
"Runs",
"the",
"given",
"operation",
"on",
"all",
"integrations",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Analytics.java#L1472-L1482 |
116,455 | segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Properties.java | Properties.putProducts | public Properties putProducts(Product... products) {
if (isNullOrEmpty(products)) {
throw new IllegalArgumentException("products cannot be null or empty.");
}
List<Product> productList = new ArrayList<>(products.length);
Collections.addAll(productList, products);
return putValue(PRODUCTS_KEY, ... | java | public Properties putProducts(Product... products) {
if (isNullOrEmpty(products)) {
throw new IllegalArgumentException("products cannot be null or empty.");
}
List<Product> productList = new ArrayList<>(products.length);
Collections.addAll(productList, products);
return putValue(PRODUCTS_KEY, ... | [
"public",
"Properties",
"putProducts",
"(",
"Product",
"...",
"products",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"products",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"products cannot be null or empty.\"",
")",
";",
"}",
"List",
"<",
... | Set the individual products for an order associated with an event.
@see <a href="https://segment.com/docs/api/tracking/ecommerce/">Ecommerce API</a> | [
"Set",
"the",
"individual",
"products",
"for",
"an",
"order",
"associated",
"with",
"an",
"event",
"."
] | 93c7d5bb09b593440a2347a6089db3e9f74012da | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Properties.java#L351-L358 |
116,456 | jaredrummler/AndroidShell | library/src/main/java/com/jaredrummler/android/shell/Shell.java | Shell.parseAvailableResult | static boolean parseAvailableResult(List<String> stdout, boolean checkForRoot) {
if (stdout == null) {
return false;
}
// this is only one of many ways this can be done
boolean echoSeen = false;
for (String line : stdout) {
if (line.contains("uid=")) {
// id command is working,... | java | static boolean parseAvailableResult(List<String> stdout, boolean checkForRoot) {
if (stdout == null) {
return false;
}
// this is only one of many ways this can be done
boolean echoSeen = false;
for (String line : stdout) {
if (line.contains("uid=")) {
// id command is working,... | [
"static",
"boolean",
"parseAvailableResult",
"(",
"List",
"<",
"String",
">",
"stdout",
",",
"boolean",
"checkForRoot",
")",
"{",
"if",
"(",
"stdout",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"// this is only one of many ways this can be done",
"boolea... | See if the shell is alive, and if so, check the UID
@param stdout
Standard output from running AVAILABLE_TEST_COMMANDS
@param checkForRoot
true if we are expecting this shell to be running as root
@return true on success, false on error | [
"See",
"if",
"the",
"shell",
"is",
"alive",
"and",
"if",
"so",
"check",
"the",
"UID"
] | 0826b6f93c208b7bc95344dd20e2989d367a1e43 | https://github.com/jaredrummler/AndroidShell/blob/0826b6f93c208b7bc95344dd20e2989d367a1e43/library/src/main/java/com/jaredrummler/android/shell/Shell.java#L231-L251 |
116,457 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/collection/mutable/SynchronizedMutableCollection.java | SynchronizedMutableCollection.of | public static <E, C extends Collection<E>> SynchronizedMutableCollection<E> of(C collection)
{
return new SynchronizedMutableCollection<E>(CollectionAdapter.adapt(collection));
} | java | public static <E, C extends Collection<E>> SynchronizedMutableCollection<E> of(C collection)
{
return new SynchronizedMutableCollection<E>(CollectionAdapter.adapt(collection));
} | [
"public",
"static",
"<",
"E",
",",
"C",
"extends",
"Collection",
"<",
"E",
">",
">",
"SynchronizedMutableCollection",
"<",
"E",
">",
"of",
"(",
"C",
"collection",
")",
"{",
"return",
"new",
"SynchronizedMutableCollection",
"<",
"E",
">",
"(",
"CollectionAdap... | This method will take a MutableCollection and wrap it directly in a SynchronizedMutableCollection. It will
take any other non-GS-collection and first adapt it will a CollectionAdapter, and then return a
SynchronizedMutableCollection that wraps the adapter. | [
"This",
"method",
"will",
"take",
"a",
"MutableCollection",
"and",
"wrap",
"it",
"directly",
"in",
"a",
"SynchronizedMutableCollection",
".",
"It",
"will",
"take",
"any",
"other",
"non",
"-",
"GS",
"-",
"collection",
"and",
"first",
"adapt",
"it",
"will",
"a... | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/collection/mutable/SynchronizedMutableCollection.java#L78-L81 |
116,458 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/mutable/CompositeFastList.java | CompositeFastList.defaultSort | @Override
protected void defaultSort(Comparator<? super E> comparator)
{
FastList<E> list = comparator == null
? (FastList<E>) this.toSortedList()
: (FastList<E>) this.toSortedList(comparator);
this.lists.clear();
this.lists.add(list);
} | java | @Override
protected void defaultSort(Comparator<? super E> comparator)
{
FastList<E> list = comparator == null
? (FastList<E>) this.toSortedList()
: (FastList<E>) this.toSortedList(comparator);
this.lists.clear();
this.lists.add(list);
} | [
"@",
"Override",
"protected",
"void",
"defaultSort",
"(",
"Comparator",
"<",
"?",
"super",
"E",
">",
"comparator",
")",
"{",
"FastList",
"<",
"E",
">",
"list",
"=",
"comparator",
"==",
"null",
"?",
"(",
"FastList",
"<",
"E",
">",
")",
"this",
".",
"t... | Override in subclasses where it can be optimized. | [
"Override",
"in",
"subclasses",
"where",
"it",
"can",
"be",
"optimized",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/mutable/CompositeFastList.java#L724-L732 |
116,459 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java | Functions.cast | public static <T, V> Function<T, V> cast(Function<T, V> function)
{
return function;
} | java | public static <T, V> Function<T, V> cast(Function<T, V> function)
{
return function;
} | [
"public",
"static",
"<",
"T",
",",
"V",
">",
"Function",
"<",
"T",
",",
"V",
">",
"cast",
"(",
"Function",
"<",
"T",
",",
"V",
">",
"function",
")",
"{",
"return",
"function",
";",
"}"
] | Allows a Java 8 lambda and method reference to be used in a method taking a Function as a parameter
without any ambiguity. | [
"Allows",
"a",
"Java",
"8",
"lambda",
"and",
"method",
"reference",
"to",
"be",
"used",
"in",
"a",
"method",
"taking",
"a",
"Function",
"as",
"a",
"parameter",
"without",
"any",
"ambiguity",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java#L201-L204 |
116,460 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java | Functions.swappedPair | public static <S, T> Function<Pair<S, T>, Pair<T, S>> swappedPair()
{
return (Function<Pair<S, T>, Pair<T, S>>) (Function<?, ?>) SWAPPED_PAIR_FUNCTION;
} | java | public static <S, T> Function<Pair<S, T>, Pair<T, S>> swappedPair()
{
return (Function<Pair<S, T>, Pair<T, S>>) (Function<?, ?>) SWAPPED_PAIR_FUNCTION;
} | [
"public",
"static",
"<",
"S",
",",
"T",
">",
"Function",
"<",
"Pair",
"<",
"S",
",",
"T",
">",
",",
"Pair",
"<",
"T",
",",
"S",
">",
">",
"swappedPair",
"(",
")",
"{",
"return",
"(",
"Function",
"<",
"Pair",
"<",
"S",
",",
"T",
">",
",",
"P... | Swap the input pair and return the swapped pair.
@return A function that gets the swapped pair {@code Iterable} | [
"Swap",
"the",
"input",
"pair",
"and",
"return",
"the",
"swapped",
"pair",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java#L370-L373 |
116,461 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java | Functions.bind | public static <T, P, R> Function<T, R> bind(Function2<? super T, ? super P, ? extends R> function, P parameter)
{
return new BindFunction2<T, P, R>(function, parameter);
} | java | public static <T, P, R> Function<T, R> bind(Function2<? super T, ? super P, ? extends R> function, P parameter)
{
return new BindFunction2<T, P, R>(function, parameter);
} | [
"public",
"static",
"<",
"T",
",",
"P",
",",
"R",
">",
"Function",
"<",
"T",
",",
"R",
">",
"bind",
"(",
"Function2",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"P",
",",
"?",
"extends",
"R",
">",
"function",
",",
"P",
"parameter",
")",
"{",
... | Bind the parameter passed to a Function2 into a new Function.
@param function The Function2 to delegate the invocation to.
@param parameter The parameter the use in the invocation of the delegate function.
@return A new Function | [
"Bind",
"the",
"parameter",
"passed",
"to",
"a",
"Function2",
"into",
"a",
"new",
"Function",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java#L382-L385 |
116,462 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java | Functions.bind | public static <T1, T2> Procedure<T1> bind(
Procedure<? super T2> delegate,
Function<? super T1, T2> function)
{
return new BindProcedure<T1, T2>(delegate, function);
} | java | public static <T1, T2> Procedure<T1> bind(
Procedure<? super T2> delegate,
Function<? super T1, T2> function)
{
return new BindProcedure<T1, T2>(delegate, function);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"Procedure",
"<",
"T1",
">",
"bind",
"(",
"Procedure",
"<",
"?",
"super",
"T2",
">",
"delegate",
",",
"Function",
"<",
"?",
"super",
"T1",
",",
"T2",
">",
"function",
")",
"{",
"return",
"new",
"BindPr... | Bind the input of a Procedure to the result of an function, returning a new Procedure.
@param delegate The Procedure to delegate the invocation to.
@param function The Function that will create the input for the delegate
@return A new Procedure | [
"Bind",
"the",
"input",
"of",
"a",
"Procedure",
"to",
"the",
"result",
"of",
"an",
"function",
"returning",
"a",
"new",
"Procedure",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java#L394-L399 |
116,463 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java | Functions.bind | public static <T1, T2> ObjectIntProcedure<T1> bind(
ObjectIntProcedure<? super T2> delegate,
Function<? super T1, T2> function)
{
return new BindObjectIntProcedure<T1, T2>(delegate, function);
} | java | public static <T1, T2> ObjectIntProcedure<T1> bind(
ObjectIntProcedure<? super T2> delegate,
Function<? super T1, T2> function)
{
return new BindObjectIntProcedure<T1, T2>(delegate, function);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"ObjectIntProcedure",
"<",
"T1",
">",
"bind",
"(",
"ObjectIntProcedure",
"<",
"?",
"super",
"T2",
">",
"delegate",
",",
"Function",
"<",
"?",
"super",
"T1",
",",
"T2",
">",
"function",
")",
"{",
"return",
... | Bind the input of a ObjectIntProcedure to the result of an function, returning a new ObjectIntProcedure.
@param delegate The ObjectIntProcedure to delegate the invocation to.
@param function The Function that will create the input for the delegate
@return A new ObjectIntProcedure | [
"Bind",
"the",
"input",
"of",
"a",
"ObjectIntProcedure",
"to",
"the",
"result",
"of",
"an",
"function",
"returning",
"a",
"new",
"ObjectIntProcedure",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java#L408-L413 |
116,464 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java | Functions.bind | public static <T1, T2, T3> Procedure2<T1, T3> bind(
Procedure2<? super T2, T3> delegate, Function<? super T1, T2> function)
{
return new BindProcedure2<T1, T2, T3>(delegate, function);
} | java | public static <T1, T2, T3> Procedure2<T1, T3> bind(
Procedure2<? super T2, T3> delegate, Function<? super T1, T2> function)
{
return new BindProcedure2<T1, T2, T3>(delegate, function);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"Procedure2",
"<",
"T1",
",",
"T3",
">",
"bind",
"(",
"Procedure2",
"<",
"?",
"super",
"T2",
",",
"T3",
">",
"delegate",
",",
"Function",
"<",
"?",
"super",
"T1",
",",
"T2",
">",
"function... | Bind the input of the first argument of a Procedure2 to the result of an function, returning a new Procedure2.
@param delegate The Procedure2 to delegate the invocation to.
@param function The Function that will create the input for the delegate
@return A new Procedure2 | [
"Bind",
"the",
"input",
"of",
"the",
"first",
"argument",
"of",
"a",
"Procedure2",
"to",
"the",
"result",
"of",
"an",
"function",
"returning",
"a",
"new",
"Procedure2",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Functions.java#L422-L426 |
116,465 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java | ArrayIterate.getFirst | public static <T> T getFirst(T[] objectArray)
{
if (ArrayIterate.notEmpty(objectArray))
{
return objectArray[0];
}
return null;
} | java | public static <T> T getFirst(T[] objectArray)
{
if (ArrayIterate.notEmpty(objectArray))
{
return objectArray[0];
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getFirst",
"(",
"T",
"[",
"]",
"objectArray",
")",
"{",
"if",
"(",
"ArrayIterate",
".",
"notEmpty",
"(",
"objectArray",
")",
")",
"{",
"return",
"objectArray",
"[",
"0",
"]",
";",
"}",
"return",
"null",
";",
... | Returns the first element of an array. This method is null safe. | [
"Returns",
"the",
"first",
"element",
"of",
"an",
"array",
".",
"This",
"method",
"is",
"null",
"safe",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java#L731-L738 |
116,466 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java | ArrayIterate.getLast | public static <T> T getLast(T[] objectArray)
{
if (ArrayIterate.notEmpty(objectArray))
{
return objectArray[objectArray.length - 1];
}
return null;
} | java | public static <T> T getLast(T[] objectArray)
{
if (ArrayIterate.notEmpty(objectArray))
{
return objectArray[objectArray.length - 1];
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getLast",
"(",
"T",
"[",
"]",
"objectArray",
")",
"{",
"if",
"(",
"ArrayIterate",
".",
"notEmpty",
"(",
"objectArray",
")",
")",
"{",
"return",
"objectArray",
"[",
"objectArray",
".",
"length",
"-",
"1",
"]",
... | Returns the last element of an Array. This method is null safe. | [
"Returns",
"the",
"last",
"element",
"of",
"an",
"Array",
".",
"This",
"method",
"is",
"null",
"safe",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java#L743-L750 |
116,467 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java | ArrayIterate.detectIndexWith | public static <T, IV> int detectIndexWith(
T[] objectArray,
Predicate2<? super T, IV> predicate,
IV injectedValue)
{
if (objectArray == null)
{
throw new IllegalArgumentException("Cannot perform a detectIndexWith on null");
}
for (int i... | java | public static <T, IV> int detectIndexWith(
T[] objectArray,
Predicate2<? super T, IV> predicate,
IV injectedValue)
{
if (objectArray == null)
{
throw new IllegalArgumentException("Cannot perform a detectIndexWith on null");
}
for (int i... | [
"public",
"static",
"<",
"T",
",",
"IV",
">",
"int",
"detectIndexWith",
"(",
"T",
"[",
"]",
"objectArray",
",",
"Predicate2",
"<",
"?",
"super",
"T",
",",
"IV",
">",
"predicate",
",",
"IV",
"injectedValue",
")",
"{",
"if",
"(",
"objectArray",
"==",
"... | Searches for the first index where the predicate evaluates to true. Returns -1 for no matches. | [
"Searches",
"for",
"the",
"first",
"index",
"where",
"the",
"predicate",
"evaluates",
"to",
"true",
".",
"Returns",
"-",
"1",
"for",
"no",
"matches",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java#L1114-L1131 |
116,468 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java | ArrayIterate.toMap | public static <T, K, V> MutableMap<K, V> toMap(
T[] objectArray,
Function<? super T, ? extends K> keyFunction,
Function<? super T, ? extends V> valueFunction)
{
MutableMap<K, V> map = UnifiedMap.newMap();
Procedure<T> procedure = new MapCollectProcedure<T, K, V>(m... | java | public static <T, K, V> MutableMap<K, V> toMap(
T[] objectArray,
Function<? super T, ? extends K> keyFunction,
Function<? super T, ? extends V> valueFunction)
{
MutableMap<K, V> map = UnifiedMap.newMap();
Procedure<T> procedure = new MapCollectProcedure<T, K, V>(m... | [
"public",
"static",
"<",
"T",
",",
"K",
",",
"V",
">",
"MutableMap",
"<",
"K",
",",
"V",
">",
"toMap",
"(",
"T",
"[",
"]",
"objectArray",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"keyFunction",
",",
"Function",
"<",... | Iterate over the specified array applying the specified Functions to each element to calculate a key
and value, and return the results as a Map. | [
"Iterate",
"over",
"the",
"specified",
"array",
"applying",
"the",
"specified",
"Functions",
"to",
"each",
"element",
"to",
"calculate",
"a",
"key",
"and",
"value",
"and",
"return",
"the",
"results",
"as",
"a",
"Map",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java#L1269-L1278 |
116,469 | goldmansachs/gs-collections | gs-collections-code-generator/src/main/java/com/gs/collections/codegenerator/GsCollectionsCodeGenerator.java | GsCollectionsCodeGenerator.generateFiles | public int generateFiles()
{
List<URL> allTemplateFilesFromClassPath = FileUtils.getAllTemplateFilesFromClasspath(this.templateDirectory, this.classPathURLs);
for (URL url : allTemplateFilesFromClassPath)
{
this.url = url;
this.templateFile = new STGroupFile(this.url,... | java | public int generateFiles()
{
List<URL> allTemplateFilesFromClassPath = FileUtils.getAllTemplateFilesFromClasspath(this.templateDirectory, this.classPathURLs);
for (URL url : allTemplateFilesFromClassPath)
{
this.url = url;
this.templateFile = new STGroupFile(this.url,... | [
"public",
"int",
"generateFiles",
"(",
")",
"{",
"List",
"<",
"URL",
">",
"allTemplateFilesFromClassPath",
"=",
"FileUtils",
".",
"getAllTemplateFilesFromClasspath",
"(",
"this",
".",
"templateDirectory",
",",
"this",
".",
"classPathURLs",
")",
";",
"for",
"(",
... | Generates code and only write contents to disk which differ from the current file contents.
@return The number of files written. | [
"Generates",
"code",
"and",
"only",
"write",
"contents",
"to",
"disk",
"which",
"differ",
"from",
"the",
"current",
"file",
"contents",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/gs-collections-code-generator/src/main/java/com/gs/collections/codegenerator/GsCollectionsCodeGenerator.java#L61-L127 |
116,470 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/bag/mutable/SynchronizedBag.java | SynchronizedBag.of | public static <E, B extends MutableBag<E>> SynchronizedBag<E> of(B bag)
{
return new SynchronizedBag<E>(bag);
} | java | public static <E, B extends MutableBag<E>> SynchronizedBag<E> of(B bag)
{
return new SynchronizedBag<E>(bag);
} | [
"public",
"static",
"<",
"E",
",",
"B",
"extends",
"MutableBag",
"<",
"E",
">",
">",
"SynchronizedBag",
"<",
"E",
">",
"of",
"(",
"B",
"bag",
")",
"{",
"return",
"new",
"SynchronizedBag",
"<",
"E",
">",
"(",
"bag",
")",
";",
"}"
] | This method will take a MutableBag and wrap it directly in a SynchronizedBag. | [
"This",
"method",
"will",
"take",
"a",
"MutableBag",
"and",
"wrap",
"it",
"directly",
"in",
"a",
"SynchronizedBag",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/bag/mutable/SynchronizedBag.java#L87-L90 |
116,471 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/map/sorted/mutable/UnmodifiableTreeMap.java | UnmodifiableTreeMap.of | public static <K, V, M extends SortedMap<K, V>> UnmodifiableTreeMap<K, V> of(M map)
{
if (map == null)
{
throw new IllegalArgumentException("cannot create a UnmodifiableSortedMap for null");
}
return new UnmodifiableTreeMap<K, V>(SortedMapAdapter.adapt(map));
} | java | public static <K, V, M extends SortedMap<K, V>> UnmodifiableTreeMap<K, V> of(M map)
{
if (map == null)
{
throw new IllegalArgumentException("cannot create a UnmodifiableSortedMap for null");
}
return new UnmodifiableTreeMap<K, V>(SortedMapAdapter.adapt(map));
} | [
"public",
"static",
"<",
"K",
",",
"V",
",",
"M",
"extends",
"SortedMap",
"<",
"K",
",",
"V",
">",
">",
"UnmodifiableTreeMap",
"<",
"K",
",",
"V",
">",
"of",
"(",
"M",
"map",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"throw",
"new",
... | This method will take a MutableSortedMap and wrap it directly in a UnmodifiableMutableMap. It will
take any other non-GS-SortedMap and first adapt it will a SortedMapAdapter, and then return a
UnmodifiableSortedMap that wraps the adapter. | [
"This",
"method",
"will",
"take",
"a",
"MutableSortedMap",
"and",
"wrap",
"it",
"directly",
"in",
"a",
"UnmodifiableMutableMap",
".",
"It",
"will",
"take",
"any",
"other",
"non",
"-",
"GS",
"-",
"SortedMap",
"and",
"first",
"adapt",
"it",
"will",
"a",
"Sor... | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/map/sorted/mutable/UnmodifiableTreeMap.java#L115-L122 |
116,472 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java | RandomAccessListIterate.forEachInBoth | public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure)
{
if (list1 != null && list2 != null)
{
int size1 = list1.size();
int size2 = list2.size();
if (size1 == size2)
{
fo... | java | public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure)
{
if (list1 != null && list2 != null)
{
int size1 = list1.size();
int size2 = list2.size();
if (size1 == size2)
{
fo... | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"void",
"forEachInBoth",
"(",
"List",
"<",
"T1",
">",
"list1",
",",
"List",
"<",
"T2",
">",
"list2",
",",
"Procedure2",
"<",
"?",
"super",
"T1",
",",
"?",
"super",
"T2",
">",
"procedure",
")",
"{",
"... | For each element in both of the Lists, operation is evaluated with both elements as parameters. | [
"For",
"each",
"element",
"in",
"both",
"of",
"the",
"Lists",
"operation",
"is",
"evaluated",
"with",
"both",
"elements",
"as",
"parameters",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java#L690-L711 |
116,473 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java | RandomAccessListIterate.forEachWithIndex | public static <T> void forEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
{
int size = list.size();
for (int i = 0; i < size; i++)
{
objectIntProcedure.value(list.get(i), i);
}
} | java | public static <T> void forEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
{
int size = list.size();
for (int i = 0; i < size; i++)
{
objectIntProcedure.value(list.get(i), i);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"forEachWithIndex",
"(",
"List",
"<",
"T",
">",
"list",
",",
"ObjectIntProcedure",
"<",
"?",
"super",
"T",
">",
"objectIntProcedure",
")",
"{",
"int",
"size",
"=",
"list",
".",
"size",
"(",
")",
";",
"for",
... | Iterates over a collection passing each element and the current relative int index to the specified instance of
ObjectIntProcedure. | [
"Iterates",
"over",
"a",
"collection",
"passing",
"each",
"element",
"and",
"the",
"current",
"relative",
"int",
"index",
"to",
"the",
"specified",
"instance",
"of",
"ObjectIntProcedure",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java#L717-L724 |
116,474 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java | RandomAccessListIterate.detectIndexWith | public static <T, IV> int detectIndexWith(List<T> list, Predicate2<? super T, ? super IV> predicate, IV injectedValue)
{
int size = list.size();
for (int i = 0; i < size; i++)
{
if (predicate.accept(list.get(i), injectedValue))
{
return i;
... | java | public static <T, IV> int detectIndexWith(List<T> list, Predicate2<? super T, ? super IV> predicate, IV injectedValue)
{
int size = list.size();
for (int i = 0; i < size; i++)
{
if (predicate.accept(list.get(i), injectedValue))
{
return i;
... | [
"public",
"static",
"<",
"T",
",",
"IV",
">",
"int",
"detectIndexWith",
"(",
"List",
"<",
"T",
">",
"list",
",",
"Predicate2",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"IV",
">",
"predicate",
",",
"IV",
"injectedValue",
")",
"{",
"int",
"size",
"... | Searches for the first occurrence where the predicate evaluates to true.
@see Iterate#detectIndexWith(Iterable, Predicate2, Object) | [
"Searches",
"for",
"the",
"first",
"occurrence",
"where",
"the",
"predicate",
"evaluates",
"to",
"true",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java#L1148-L1159 |
116,475 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/collection/mutable/UnmodifiableMutableCollection.java | UnmodifiableMutableCollection.of | public static <E, C extends Collection<E>> UnmodifiableMutableCollection<E> of(C collection)
{
if (collection == null)
{
throw new IllegalArgumentException("cannot create a UnmodifiableMutableCollection for null");
}
return new UnmodifiableMutableCollection<E>(CollectionA... | java | public static <E, C extends Collection<E>> UnmodifiableMutableCollection<E> of(C collection)
{
if (collection == null)
{
throw new IllegalArgumentException("cannot create a UnmodifiableMutableCollection for null");
}
return new UnmodifiableMutableCollection<E>(CollectionA... | [
"public",
"static",
"<",
"E",
",",
"C",
"extends",
"Collection",
"<",
"E",
">",
">",
"UnmodifiableMutableCollection",
"<",
"E",
">",
"of",
"(",
"C",
"collection",
")",
"{",
"if",
"(",
"collection",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgument... | This method will take a MutableCollection and wrap it directly in a UnmodifiableMutableCollection. It will
take any other non-GS-collection and first adapt it will a CollectionAdapter, and then return a
UnmodifiableMutableCollection that wraps the adapter. | [
"This",
"method",
"will",
"take",
"a",
"MutableCollection",
"and",
"wrap",
"it",
"directly",
"in",
"a",
"UnmodifiableMutableCollection",
".",
"It",
"will",
"take",
"any",
"other",
"non",
"-",
"GS",
"-",
"collection",
"and",
"first",
"adapt",
"it",
"will",
"a... | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/collection/mutable/UnmodifiableMutableCollection.java#L43-L50 |
116,476 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/SynchronizedRichIterable.java | SynchronizedRichIterable.of | public static <E> SynchronizedRichIterable<E> of(RichIterable<E> iterable)
{
return new SynchronizedRichIterable<E>(iterable);
} | java | public static <E> SynchronizedRichIterable<E> of(RichIterable<E> iterable)
{
return new SynchronizedRichIterable<E>(iterable);
} | [
"public",
"static",
"<",
"E",
">",
"SynchronizedRichIterable",
"<",
"E",
">",
"of",
"(",
"RichIterable",
"<",
"E",
">",
"iterable",
")",
"{",
"return",
"new",
"SynchronizedRichIterable",
"<",
"E",
">",
"(",
"iterable",
")",
";",
"}"
] | This method will take a RichIterable and wrap it directly in a SynchronizedRichIterable. | [
"This",
"method",
"will",
"take",
"a",
"RichIterable",
"and",
"wrap",
"it",
"directly",
"in",
"a",
"SynchronizedRichIterable",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/SynchronizedRichIterable.java#L110-L113 |
116,477 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/SynchronizedRichIterable.java | SynchronizedRichIterable.of | public static <E> SynchronizedRichIterable<E> of(RichIterable<E> iterable, Object lock)
{
return new SynchronizedRichIterable<E>(iterable, lock);
} | java | public static <E> SynchronizedRichIterable<E> of(RichIterable<E> iterable, Object lock)
{
return new SynchronizedRichIterable<E>(iterable, lock);
} | [
"public",
"static",
"<",
"E",
">",
"SynchronizedRichIterable",
"<",
"E",
">",
"of",
"(",
"RichIterable",
"<",
"E",
">",
"iterable",
",",
"Object",
"lock",
")",
"{",
"return",
"new",
"SynchronizedRichIterable",
"<",
"E",
">",
"(",
"iterable",
",",
"lock",
... | This method will take a RichIterable and wrap it directly in a SynchronizedRichIterable. Additionally,
a developer specifies which lock to use with the collection. | [
"This",
"method",
"will",
"take",
"a",
"RichIterable",
"and",
"wrap",
"it",
"directly",
"in",
"a",
"SynchronizedRichIterable",
".",
"Additionally",
"a",
"developer",
"specifies",
"which",
"lock",
"to",
"use",
"with",
"the",
"collection",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/SynchronizedRichIterable.java#L119-L122 |
116,478 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/parallel/ArrayProcedureFJTaskRunner.java | ArrayProcedureFJTaskRunner.createAndExecuteTasks | private void createAndExecuteTasks(Executor executor, ProcedureFactory<BT> procedureFactory, T[] array)
{
this.procedures = new ArrayProcedureFJTask[this.taskCount];
int sectionSize = array.length / this.taskCount;
int size = this.taskCount;
for (int index = 0; index < size; index++)... | java | private void createAndExecuteTasks(Executor executor, ProcedureFactory<BT> procedureFactory, T[] array)
{
this.procedures = new ArrayProcedureFJTask[this.taskCount];
int sectionSize = array.length / this.taskCount;
int size = this.taskCount;
for (int index = 0; index < size; index++)... | [
"private",
"void",
"createAndExecuteTasks",
"(",
"Executor",
"executor",
",",
"ProcedureFactory",
"<",
"BT",
">",
"procedureFactory",
",",
"T",
"[",
"]",
"array",
")",
"{",
"this",
".",
"procedures",
"=",
"new",
"ArrayProcedureFJTask",
"[",
"this",
".",
"taskC... | Creates an array of ProcedureFJTasks wrapping Procedures created by the specified ProcedureFactory. | [
"Creates",
"an",
"array",
"of",
"ProcedureFJTasks",
"wrapping",
"Procedures",
"created",
"by",
"the",
"specified",
"ProcedureFactory",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/parallel/ArrayProcedureFJTaskRunner.java#L57-L69 |
116,479 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/bag/mutable/UnmodifiableBag.java | UnmodifiableBag.of | public static <E, B extends MutableBag<E>> UnmodifiableBag<E> of(B bag)
{
if (bag == null)
{
throw new IllegalArgumentException("cannot create an UnmodifiableBag for null");
}
return new UnmodifiableBag<E>(bag);
} | java | public static <E, B extends MutableBag<E>> UnmodifiableBag<E> of(B bag)
{
if (bag == null)
{
throw new IllegalArgumentException("cannot create an UnmodifiableBag for null");
}
return new UnmodifiableBag<E>(bag);
} | [
"public",
"static",
"<",
"E",
",",
"B",
"extends",
"MutableBag",
"<",
"E",
">",
">",
"UnmodifiableBag",
"<",
"E",
">",
"of",
"(",
"B",
"bag",
")",
"{",
"if",
"(",
"bag",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"cann... | This method will take a MutableBag and wrap it directly in a UnmodifiableBag. | [
"This",
"method",
"will",
"take",
"a",
"MutableBag",
"and",
"wrap",
"it",
"directly",
"in",
"a",
"UnmodifiableBag",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/bag/mutable/UnmodifiableBag.java#L79-L86 |
116,480 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/parallel/ParallelIterate.java | ParallelIterate.newPooledExecutor | public static ExecutorService newPooledExecutor(String poolName, boolean useDaemonThreads)
{
return ParallelIterate.newPooledExecutor(ParallelIterate.getDefaultMaxThreadPoolSize(), poolName, useDaemonThreads);
} | java | public static ExecutorService newPooledExecutor(String poolName, boolean useDaemonThreads)
{
return ParallelIterate.newPooledExecutor(ParallelIterate.getDefaultMaxThreadPoolSize(), poolName, useDaemonThreads);
} | [
"public",
"static",
"ExecutorService",
"newPooledExecutor",
"(",
"String",
"poolName",
",",
"boolean",
"useDaemonThreads",
")",
"{",
"return",
"ParallelIterate",
".",
"newPooledExecutor",
"(",
"ParallelIterate",
".",
"getDefaultMaxThreadPoolSize",
"(",
")",
",",
"poolNa... | Returns a brand new ExecutorService using the specified poolName and uses the optional property named
to set the maximum thread pool size. The same poolName may be used more than
once resulting in multiple pools with the same name. | [
"Returns",
"a",
"brand",
"new",
"ExecutorService",
"using",
"the",
"specified",
"poolName",
"and",
"uses",
"the",
"optional",
"property",
"named",
"to",
"set",
"the",
"maximum",
"thread",
"pool",
"size",
".",
"The",
"same",
"poolName",
"may",
"be",
"used",
"... | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/parallel/ParallelIterate.java#L1361-L1364 |
116,481 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/mutable/SynchronizedMutableList.java | SynchronizedMutableList.of | public static <E, L extends List<E>> SynchronizedMutableList<E> of(L list, Object lock)
{
MutableList<E> mutableList =
list instanceof MutableList ? (MutableList<E>) list : ListAdapter.adapt(list);
return new SynchronizedMutableList<E>(mutableList, lock);
} | java | public static <E, L extends List<E>> SynchronizedMutableList<E> of(L list, Object lock)
{
MutableList<E> mutableList =
list instanceof MutableList ? (MutableList<E>) list : ListAdapter.adapt(list);
return new SynchronizedMutableList<E>(mutableList, lock);
} | [
"public",
"static",
"<",
"E",
",",
"L",
"extends",
"List",
"<",
"E",
">",
">",
"SynchronizedMutableList",
"<",
"E",
">",
"of",
"(",
"L",
"list",
",",
"Object",
"lock",
")",
"{",
"MutableList",
"<",
"E",
">",
"mutableList",
"=",
"list",
"instanceof",
... | This method will take a MutableList and wrap it directly in a SynchronizedMutableList. It will
take any other non-GS-collection and first adapt it will a ListAdapter, and then return a
SynchronizedMutableList that wraps the adapter. Additionally, a developer specifies which lock to use
with the collection. | [
"This",
"method",
"will",
"take",
"a",
"MutableList",
"and",
"wrap",
"it",
"directly",
"in",
"a",
"SynchronizedMutableList",
".",
"It",
"will",
"take",
"any",
"other",
"non",
"-",
"GS",
"-",
"collection",
"and",
"first",
"adapt",
"it",
"will",
"a",
"ListAd... | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/mutable/SynchronizedMutableList.java#L107-L112 |
116,482 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/mutable/FastList.java | FastList.newWithNValues | public static <E> FastList<E> newWithNValues(int size, Function0<E> factory)
{
FastList<E> newFastList = FastList.newList(size);
for (int i = 0; i < size; i++)
{
newFastList.add(factory.value());
}
return newFastList;
} | java | public static <E> FastList<E> newWithNValues(int size, Function0<E> factory)
{
FastList<E> newFastList = FastList.newList(size);
for (int i = 0; i < size; i++)
{
newFastList.add(factory.value());
}
return newFastList;
} | [
"public",
"static",
"<",
"E",
">",
"FastList",
"<",
"E",
">",
"newWithNValues",
"(",
"int",
"size",
",",
"Function0",
"<",
"E",
">",
"factory",
")",
"{",
"FastList",
"<",
"E",
">",
"newFastList",
"=",
"FastList",
".",
"newList",
"(",
"size",
")",
";"... | Creates a new FastList pre-sized to the specified size filled with default values generated by the specified function.
@since 3.0 | [
"Creates",
"a",
"new",
"FastList",
"pre",
"-",
"sized",
"to",
"the",
"specified",
"size",
"filled",
"with",
"default",
"values",
"generated",
"by",
"the",
"specified",
"function",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/mutable/FastList.java#L192-L200 |
116,483 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/mutable/FastList.java | FastList.trimToSizeIfGreaterThanPercent | public boolean trimToSizeIfGreaterThanPercent(double loadFactor)
{
double excessCapacity = 1.0 - (double) this.size / (double) this.items.length;
if (excessCapacity > loadFactor)
{
this.trimToSize();
return true;
}
return false;
} | java | public boolean trimToSizeIfGreaterThanPercent(double loadFactor)
{
double excessCapacity = 1.0 - (double) this.size / (double) this.items.length;
if (excessCapacity > loadFactor)
{
this.trimToSize();
return true;
}
return false;
} | [
"public",
"boolean",
"trimToSizeIfGreaterThanPercent",
"(",
"double",
"loadFactor",
")",
"{",
"double",
"excessCapacity",
"=",
"1.0",
"-",
"(",
"double",
")",
"this",
".",
"size",
"/",
"(",
"double",
")",
"this",
".",
"items",
".",
"length",
";",
"if",
"("... | Express load factor as 0.25 to trim a collection with more than 25% excess capacity | [
"Express",
"load",
"factor",
"as",
"0",
".",
"25",
"to",
"trim",
"a",
"collection",
"with",
"more",
"than",
"25%",
"excess",
"capacity"
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/mutable/FastList.java#L411-L420 |
116,484 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java | ListIterate.getFirst | public static <T> T getFirst(List<T> collection)
{
return Iterate.isEmpty(collection) ? null : collection.get(0);
} | java | public static <T> T getFirst(List<T> collection)
{
return Iterate.isEmpty(collection) ? null : collection.get(0);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getFirst",
"(",
"List",
"<",
"T",
">",
"collection",
")",
"{",
"return",
"Iterate",
".",
"isEmpty",
"(",
"collection",
")",
"?",
"null",
":",
"collection",
".",
"get",
"(",
"0",
")",
";",
"}"
] | Returns the first element of a list. | [
"Returns",
"the",
"first",
"element",
"of",
"a",
"list",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L624-L627 |
116,485 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java | ListIterate.reverseForEach | public static <T> void reverseForEach(List<T> list, Procedure<? super T> procedure)
{
if (!list.isEmpty())
{
ListIterate.forEach(list, list.size() - 1, 0, procedure);
}
} | java | public static <T> void reverseForEach(List<T> list, Procedure<? super T> procedure)
{
if (!list.isEmpty())
{
ListIterate.forEach(list, list.size() - 1, 0, procedure);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"reverseForEach",
"(",
"List",
"<",
"T",
">",
"list",
",",
"Procedure",
"<",
"?",
"super",
"T",
">",
"procedure",
")",
"{",
"if",
"(",
"!",
"list",
".",
"isEmpty",
"(",
")",
")",
"{",
"ListIterate",
".",
... | Iterates over the List in reverse order executing the Procedure for each element | [
"Iterates",
"over",
"the",
"List",
"in",
"reverse",
"order",
"executing",
"the",
"Procedure",
"for",
"each",
"element"
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L668-L674 |
116,486 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java | ListIterate.reverseForEachWithIndex | public static <T> void reverseForEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
{
if (!list.isEmpty())
{
ListIterate.forEachWithIndex(list, list.size() - 1, 0, objectIntProcedure);
}
} | java | public static <T> void reverseForEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure)
{
if (!list.isEmpty())
{
ListIterate.forEachWithIndex(list, list.size() - 1, 0, objectIntProcedure);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"reverseForEachWithIndex",
"(",
"List",
"<",
"T",
">",
"list",
",",
"ObjectIntProcedure",
"<",
"?",
"super",
"T",
">",
"objectIntProcedure",
")",
"{",
"if",
"(",
"!",
"list",
".",
"isEmpty",
"(",
")",
")",
"{"... | Iterates over the List in reverse order executing the Procedure for each element. The index passed into the ObjectIntProcedure is the actual index of the
range. | [
"Iterates",
"over",
"the",
"List",
"in",
"reverse",
"order",
"executing",
"the",
"Procedure",
"for",
"each",
"element",
".",
"The",
"index",
"passed",
"into",
"the",
"ObjectIntProcedure",
"is",
"the",
"actual",
"index",
"of",
"the",
"range",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L680-L686 |
116,487 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java | ListIterate.forEachInBoth | public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure)
{
if (list1 != null && list2 != null)
{
if (list1.size() == list2.size())
{
if (list1 instanceof RandomAccess && list2 instanceof RandomAcce... | java | public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure)
{
if (list1 != null && list2 != null)
{
if (list1.size() == list2.size())
{
if (list1 instanceof RandomAccess && list2 instanceof RandomAcce... | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"void",
"forEachInBoth",
"(",
"List",
"<",
"T1",
">",
"list1",
",",
"List",
"<",
"T2",
">",
"list2",
",",
"Procedure2",
"<",
"?",
"super",
"T1",
",",
"?",
"super",
"T2",
">",
"procedure",
")",
"{",
"... | Iterates over both lists together, evaluating Procedure2 with the current element from each list. | [
"Iterates",
"over",
"both",
"lists",
"together",
"evaluating",
"Procedure2",
"with",
"the",
"current",
"element",
"from",
"each",
"list",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L806-L835 |
116,488 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java | ListIterate.detectLastIndex | public static <T> int detectLastIndex(List<T> list, Predicate<? super T> predicate)
{
if (list instanceof RandomAccess)
{
return RandomAccessListIterate.detectLastIndex(list, predicate);
}
int size = list.size();
int i = size - 1;
ListIterator<T> reverseIt... | java | public static <T> int detectLastIndex(List<T> list, Predicate<? super T> predicate)
{
if (list instanceof RandomAccess)
{
return RandomAccessListIterate.detectLastIndex(list, predicate);
}
int size = list.size();
int i = size - 1;
ListIterator<T> reverseIt... | [
"public",
"static",
"<",
"T",
">",
"int",
"detectLastIndex",
"(",
"List",
"<",
"T",
">",
"list",
",",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"if",
"(",
"list",
"instanceof",
"RandomAccess",
")",
"{",
"return",
"RandomAccessListI... | Returns the last index where the predicate evaluates to true.
Returns -1 for no matches. | [
"Returns",
"the",
"last",
"index",
"where",
"the",
"predicate",
"evaluates",
"to",
"true",
".",
"Returns",
"-",
"1",
"for",
"no",
"matches",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L1243-L1261 |
116,489 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.forEachToken | public static void forEachToken(String string, String separator, Procedure<String> procedure)
{
for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); )
{
String token = stringTokenizer.nextToken();
procedure.value(toke... | java | public static void forEachToken(String string, String separator, Procedure<String> procedure)
{
for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); )
{
String token = stringTokenizer.nextToken();
procedure.value(toke... | [
"public",
"static",
"void",
"forEachToken",
"(",
"String",
"string",
",",
"String",
"separator",
",",
"Procedure",
"<",
"String",
">",
"procedure",
")",
"{",
"for",
"(",
"StringTokenizer",
"stringTokenizer",
"=",
"new",
"StringTokenizer",
"(",
"string",
",",
"... | For each token in a string separated by the specified separator, execute the specified StringProcedure
by calling the valueOfString method. | [
"For",
"each",
"token",
"in",
"a",
"string",
"separated",
"by",
"the",
"specified",
"separator",
"execute",
"the",
"specified",
"StringProcedure",
"by",
"calling",
"the",
"valueOfString",
"method",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L285-L292 |
116,490 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.occurrencesOfChar | public static int occurrencesOfChar(String string, final char value)
{
return StringIterate.countChar(string, new CharPredicate()
{
public boolean accept(char character)
{
return value == character;
}
});
} | java | public static int occurrencesOfChar(String string, final char value)
{
return StringIterate.countChar(string, new CharPredicate()
{
public boolean accept(char character)
{
return value == character;
}
});
} | [
"public",
"static",
"int",
"occurrencesOfChar",
"(",
"String",
"string",
",",
"final",
"char",
"value",
")",
"{",
"return",
"StringIterate",
".",
"countChar",
"(",
"string",
",",
"new",
"CharPredicate",
"(",
")",
"{",
"public",
"boolean",
"accept",
"(",
"cha... | Count the number of occurrences of the specified char.
@since 7.0 | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"the",
"specified",
"char",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L736-L745 |
116,491 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.occurrencesOfCodePoint | public static int occurrencesOfCodePoint(String string, final int value)
{
return StringIterate.countCodePoint(string, new CodePointPredicate()
{
public boolean accept(int codePoint)
{
return value == codePoint;
}
});
} | java | public static int occurrencesOfCodePoint(String string, final int value)
{
return StringIterate.countCodePoint(string, new CodePointPredicate()
{
public boolean accept(int codePoint)
{
return value == codePoint;
}
});
} | [
"public",
"static",
"int",
"occurrencesOfCodePoint",
"(",
"String",
"string",
",",
"final",
"int",
"value",
")",
"{",
"return",
"StringIterate",
".",
"countCodePoint",
"(",
"string",
",",
"new",
"CodePointPredicate",
"(",
")",
"{",
"public",
"boolean",
"accept",... | Count the number of occurrences of the specified int code point.
@since 7.0 | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"the",
"specified",
"int",
"code",
"point",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L763-L772 |
116,492 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.chunk | public static MutableList<String> chunk(String string, int size)
{
if (size <= 0)
{
throw new IllegalArgumentException("Size for groups must be positive but was: " + size);
}
int length = string.length();
if (length == 0)
{
return FastList.ne... | java | public static MutableList<String> chunk(String string, int size)
{
if (size <= 0)
{
throw new IllegalArgumentException("Size for groups must be positive but was: " + size);
}
int length = string.length();
if (length == 0)
{
return FastList.ne... | [
"public",
"static",
"MutableList",
"<",
"String",
">",
"chunk",
"(",
"String",
"string",
",",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Size for groups must be positive but was: \"",
"+",... | Partitions String in fixed size chunks.
@param size the number of characters per chunk
@return A {@code MutableList} containing {@code String}s of size {@code size}, except the last will be
truncated (i.e. shorter) if the characters don't divide evenly.
@since 5.2 | [
"Partitions",
"String",
"in",
"fixed",
"size",
"chunks",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L1246-L1270 |
116,493 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.selectWith | public static <T, P, R extends Collection<T>> R selectWith(
Iterable<T> iterable,
Predicate2<? super T, ? super P> predicate,
P parameter,
R targetCollection)
{
if (iterable instanceof RichIterable)
{
return ((RichIterable<T>) iterable).sel... | java | public static <T, P, R extends Collection<T>> R selectWith(
Iterable<T> iterable,
Predicate2<? super T, ? super P> predicate,
P parameter,
R targetCollection)
{
if (iterable instanceof RichIterable)
{
return ((RichIterable<T>) iterable).sel... | [
"public",
"static",
"<",
"T",
",",
"P",
",",
"R",
"extends",
"Collection",
"<",
"T",
">",
">",
"R",
"selectWith",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"Predicate2",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"P",
">",
"predicate",
",",
... | Same as the selectWith method with two parameters but uses the specified target collection. | [
"Same",
"as",
"the",
"selectWith",
"method",
"with",
"two",
"parameters",
"but",
"uses",
"the",
"specified",
"target",
"collection",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L699-L722 |
116,494 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.sortThisBy | public static <T, V extends Comparable<? super V>, L extends List<T>> L sortThisBy(L list, Function<? super T, ? extends V> function)
{
return Iterate.sortThis(list, Comparators.byFunction(function));
} | java | public static <T, V extends Comparable<? super V>, L extends List<T>> L sortThisBy(L list, Function<? super T, ? extends V> function)
{
return Iterate.sortThis(list, Comparators.byFunction(function));
} | [
"public",
"static",
"<",
"T",
",",
"V",
"extends",
"Comparable",
"<",
"?",
"super",
"V",
">",
",",
"L",
"extends",
"List",
"<",
"T",
">",
">",
"L",
"sortThisBy",
"(",
"L",
"list",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"V",... | Sort the list by comparing an attribute defined by the function.
SortThisBy is a mutating method. The List passed in is also returned. | [
"Sort",
"the",
"list",
"by",
"comparing",
"an",
"attribute",
"defined",
"by",
"the",
"function",
".",
"SortThisBy",
"is",
"a",
"mutating",
"method",
".",
"The",
"List",
"passed",
"in",
"is",
"also",
"returned",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L919-L922 |
116,495 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.removeIf | public static <T> boolean removeIf(Iterable<T> iterable, Predicate<? super T> predicate)
{
if (iterable instanceof MutableCollection)
{
return ((MutableCollection<T>) iterable).removeIf(predicate);
}
if (iterable instanceof ArrayList)
{
return ArrayLis... | java | public static <T> boolean removeIf(Iterable<T> iterable, Predicate<? super T> predicate)
{
if (iterable instanceof MutableCollection)
{
return ((MutableCollection<T>) iterable).removeIf(predicate);
}
if (iterable instanceof ArrayList)
{
return ArrayLis... | [
"public",
"static",
"<",
"T",
">",
"boolean",
"removeIf",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"if",
"(",
"iterable",
"instanceof",
"MutableCollection",
")",
"{",
"return",
"(",... | Removes all elements from the iterable that evaluate to true for the specified predicate. | [
"Removes",
"all",
"elements",
"from",
"the",
"iterable",
"that",
"evaluate",
"to",
"true",
"for",
"the",
"specified",
"predicate",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L927-L946 |
116,496 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.removeIfWith | public static <T, P> boolean removeIfWith(
Iterable<T> iterable,
Predicate2<? super T, ? super P> predicate,
P parameter)
{
if (iterable instanceof MutableCollection)
{
return ((MutableCollection<T>) iterable).removeIfWith(predicate, parameter);
... | java | public static <T, P> boolean removeIfWith(
Iterable<T> iterable,
Predicate2<? super T, ? super P> predicate,
P parameter)
{
if (iterable instanceof MutableCollection)
{
return ((MutableCollection<T>) iterable).removeIfWith(predicate, parameter);
... | [
"public",
"static",
"<",
"T",
",",
"P",
">",
"boolean",
"removeIfWith",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"Predicate2",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"P",
">",
"predicate",
",",
"P",
"parameter",
")",
"{",
"if",
"(",
"it... | Removes all elements of the iterable that evaluate to true for the specified predicate2 and parameter. | [
"Removes",
"all",
"elements",
"of",
"the",
"iterable",
"that",
"evaluate",
"to",
"true",
"for",
"the",
"specified",
"predicate2",
"and",
"parameter",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L951-L973 |
116,497 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.rejectWith | public static <T, P, R extends Collection<T>> R rejectWith(
Iterable<T> iterable,
Predicate2<? super T, ? super P> predicate,
P parameter,
R targetCollection)
{
if (iterable instanceof RichIterable)
{
return ((RichIterable<T>) iterable).rej... | java | public static <T, P, R extends Collection<T>> R rejectWith(
Iterable<T> iterable,
Predicate2<? super T, ? super P> predicate,
P parameter,
R targetCollection)
{
if (iterable instanceof RichIterable)
{
return ((RichIterable<T>) iterable).rej... | [
"public",
"static",
"<",
"T",
",",
"P",
",",
"R",
"extends",
"Collection",
"<",
"T",
">",
">",
"R",
"rejectWith",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"Predicate2",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"P",
">",
"predicate",
",",
... | Same as the reject method with two parameters but uses the specified target collection. | [
"Same",
"as",
"the",
"reject",
"method",
"with",
"two",
"parameters",
"but",
"uses",
"the",
"specified",
"target",
"collection",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1083-L1110 |
116,498 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.addAllTo | public static <T, R extends Collection<T>> R addAllTo(Iterable<? extends T> iterable, R targetCollection)
{
Iterate.addAllIterable(iterable, targetCollection);
return targetCollection;
} | java | public static <T, R extends Collection<T>> R addAllTo(Iterable<? extends T> iterable, R targetCollection)
{
Iterate.addAllIterable(iterable, targetCollection);
return targetCollection;
} | [
"public",
"static",
"<",
"T",
",",
"R",
"extends",
"Collection",
"<",
"T",
">",
">",
"R",
"addAllTo",
"(",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"iterable",
",",
"R",
"targetCollection",
")",
"{",
"Iterate",
".",
"addAllIterable",
"(",
"iterable",
... | Add all elements from the source Iterable to the target collection, return the target collection. | [
"Add",
"all",
"elements",
"from",
"the",
"source",
"Iterable",
"to",
"the",
"target",
"collection",
"return",
"the",
"target",
"collection",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1115-L1119 |
116,499 | goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.addAllIterable | public static <T> boolean addAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection)
{
if (iterable == null)
{
throw new NullPointerException();
}
if (iterable instanceof Collection<?>)
{
return targetCollection.addAll((Collection<T... | java | public static <T> boolean addAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection)
{
if (iterable == null)
{
throw new NullPointerException();
}
if (iterable instanceof Collection<?>)
{
return targetCollection.addAll((Collection<T... | [
"public",
"static",
"<",
"T",
">",
"boolean",
"addAllIterable",
"(",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"iterable",
",",
"Collection",
"<",
"T",
">",
"targetCollection",
")",
"{",
"if",
"(",
"iterable",
"==",
"null",
")",
"{",
"throw",
"new",
"... | Add all elements from the source Iterable to the target collection, returns true if any element was added. | [
"Add",
"all",
"elements",
"from",
"the",
"source",
"Iterable",
"to",
"the",
"target",
"collection",
"returns",
"true",
"if",
"any",
"element",
"was",
"added",
"."
] | fa8bf3e103689efa18bca2ab70203e71cde34b52 | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1124-L1137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.