Java Code Examples for com.google.common.collect.Iterators#find()
The following examples show how to use
com.google.common.collect.Iterators#find() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArtifactContainerImpl.java From blueocean-plugin with MIT License | 5 votes |
@Override public BlueArtifact get(final String name) { // Check security for artifacts if(Functions.isArtifactsPermissionEnabled() && !run.hasPermission(Run.ARTIFACTS)) { return null; } return Iterators.find(iterator(), new Predicate<BlueArtifact>() { @Override public boolean apply(@Nullable BlueArtifact input) { return input != null && input.getId().equals(name); } }, null); }
Example 2
Source File: BlueTrendContainerImpl.java From blueocean-plugin with MIT License | 5 votes |
@Override public BlueTrend get(final String name) { BlueTrend trend = Iterators.find(iterator(), new Predicate<BlueTrend>() { @Override public boolean apply(@Nullable BlueTrend input) { return input != null && input.getId().equals(name); } }, null); if (trend == null) { throw new ServiceException.NotFoundException("not found"); } return trend; }
Example 3
Source File: GithubServerContainer.java From blueocean-plugin with MIT License | 5 votes |
private GithubServer findByName(final String name) { return (GithubServer) Iterators.find(iterator(), new Predicate<ScmServerEndpoint>() { @Override public boolean apply(ScmServerEndpoint input) { return input.getName().equals(name); } }, null); }
Example 4
Source File: ResourceTreeTableModel.java From ganttproject with GNU General Public License v3.0 | 5 votes |
public ResourceNode getNodeForResource(final HumanResource hr) { try { return (ResourceNode) Iterators.find(Iterators.forEnumeration(root.children()), new Predicate<MutableTreeTableNode>() { @Override public boolean apply(MutableTreeTableNode input) { return input.getUserObject().equals(hr); } }); } catch (NoSuchElementException e) { return null; } }