Tabnine Logo
CollectionUtil.filter
Code IndexAdd Tabnine to your IDE (free)

How to use
filter
method
in
com.atlassian.jira.util.collect.CollectionUtil

Best Java code snippets using com.atlassian.jira.util.collect.CollectionUtil.filter (Showing top 15 results out of 315)

origin: com.atlassian.jira/jira-core

private List<KeyboardShortcut> getShortcuts(final KeyboardShortcutManager.Context context, final List<KeyboardShortcut> shortcuts)
{
  return new ArrayList<KeyboardShortcut>(CollectionUtil.filter(shortcuts, new Predicate<KeyboardShortcut>()
  {
    public boolean evaluate(final KeyboardShortcut input)
    {
      return context.equals(input.getContext());
    }
  }));
}
origin: com.atlassian.jira/jira-api

/**
 * Does the supplied {@link Iterator} contain anything that matches the predicate?
 *
 * @param <T> the element type
 * @param iterator containing elements
 * @param predicate the matcher
 * @return true if the predicate returns true for any elements.
 */
public static <T> boolean contains(@Nonnull final Iterator<? extends T> iterator, @Nonnull final Predicate<T> predicate)
{
  return filter(iterator, predicate).hasNext();
}
origin: com.atlassian.jira/jira-api

public static <T, R> Iterable<R> transformAndFilter(final Iterable<T> iterable, final Function<T, R> transformer, final Predicate<R> predicate)
{
  return filter(transform(iterable, transformer), predicate);
}
origin: com.atlassian.jira/jira-api

/**
 * Returns all temporary attachments, which were bound to given form token. Form token may not be null.
 *
 * @param formToken
 * @return a collection of temporary attachments for this form token sorted by creation date
 */
public Collection<TemporaryAttachment> getByFormToken(final String formToken)
{
  if(formToken == null)
  {
    return Collections.emptyList();
  }
  final List<TemporaryAttachment> ret = new ArrayList<TemporaryAttachment>(CollectionUtil.filter(temporaryAttachments.values(), new Predicate<TemporaryAttachment>()
  {
    public boolean evaluate(final TemporaryAttachment input)
    {
      return formToken.equals(input.getFormToken());
    }
  }));
  Collections.sort(ret);
  return ret;
}
origin: com.atlassian.jira/jira-core

@Override
public Collection<IssueLinkType> getIssueLinkTypes(boolean excludeSystemLinks)
{
  Collection<IssueLinkType> types = ImmutableList.copyOf(cache.get().values());
  if (!excludeSystemLinks)
  {
    return types;
  }
  return CollectionUtil.filter(types, new Predicate<IssueLinkType>()
  {
    @Override
    public boolean evaluate(final IssueLinkType type)
    {
      return !type.isSystemLinkType();
    }
  });
}
origin: com.atlassian.jira/jira-core

final Iterator<String> disallowedIds = CollectionUtil.filter(projectStringIds.iterator(), new Predicate<String>()
origin: com.atlassian.jira/jira-api

/**
 * Filter a {@link Collection} for the specified subtype.
 *
 * @param <T> the incoming type
 * @param <R> the result type
 * @param iterable an iterable whose values are of the source type
 * @param subclass the result type, only return elements if they are of this type
 * @return a filtered {@link Collection} of the subtype
 */
public static <T, R extends T> Collection<R> filterByType(@Nonnull final Iterable<T> iterable, @Nonnull final Class<R> subclass)
{
  return transform(filter(iterable, Predicates.<T> isInstanceOf(subclass)), Functions.<T, R> downcast(subclass));
}
origin: com.atlassian.jira/jira-core

@Override
public void refreshLiveNodes()
{
  final Collection<String> heartbeatLiveNodesIds = heartbeatServiceRef.get().findLiveNodes();
  Collection<Node> filter = CollectionUtil.filter(getAllNodes(), new Predicate<Node>()
  {
    @Override
    public boolean evaluate(final Node node)
    {
      return node != null && node.getState() == ACTIVE && heartbeatLiveNodesIds.contains(node.getNodeId());
    }
  });
  liveNodes = ImmutableSet.<Node>copyOf(filter);
}
origin: com.atlassian.jira/jira-core

private Collection<IssueLinkType> getIssueLinkTypesByPredicate(final Predicate<GenericValue> predicate)
{
  final Collection<GenericValue> inwardLinkTypes = CollectionUtil.filter(
      queryDatabase(OfBizDelegator.ISSUE_LINK_TYPE, MapBuilder.<String, Object>emptyMap()),
      predicate);
  return buildIssueLinkTypes(inwardLinkTypes, false);
}
origin: com.atlassian.jira/jira-core

public List<ProjectAndRole> getProjects(final ApplicationUser user)
{
  final Collection<Project> projects = projectManager.getProjectObjects();
  final ImmutableList.Builder<ProjectAndRole> resultsBuilder = ImmutableList.builder();
  final Set<ProjectRoleActor> allRoleActorsForUser = roleActorFactory.getAllRoleActorsForUser(user);
  resultsBuilder.addAll(Iterables.transform(allRoleActorsForUser, new Function<ProjectRoleActor, ProjectAndRole>()
  {
    @Override
    public ProjectAndRole apply(final ProjectRoleActor simpleRoleActor)
    {
      return new ProjectAndRole(simpleRoleActor.getProjectId(), simpleRoleActor.getProjectRoleId());
    }
  }));
  for (final Project project : CollectionUtil.filter(projects, new Predicate<Project>()
  {
    public boolean evaluate(final Project o)
    {
      return permissionManager.hasPermission(BROWSE_PROJECTS, o, user);
    }
  }))
  {
    resultsBuilder.add(new ProjectAndRole(project.getId()));
  }
  return resultsBuilder.build();
}
origin: com.atlassian.jira/jira-gadgets-plugin

@GET
@Path ("gadget/fields")
@Produces (MediaType.APPLICATION_JSON)
public Response getLabelFields()
{
  @SuppressWarnings ("unchecked")
  final Collection<CustomField> labelCfTypes = CollectionUtil.filter(
      customFieldManager.getCustomFieldObjects(), new Predicate<CustomField>()
      {
        public boolean evaluate(final CustomField input)
        {
          return input.getCustomFieldType() instanceof LabelsCFType;
        }
      }
  );
  final List<LabelField> labelFields = new ArrayList<LabelField>(labelCfTypes.size() + 1);
  labelFields.add(new LabelField(authenticationContext.getI18nHelper().getText("issue.field.labels"),
      IssueFieldConstants.LABELS));
  for (CustomField labelCf : labelCfTypes)
  {
    LabelField labelField = new LabelField(labelCf.getName(), labelCf.getId());
    labelFields.add(labelField);
  }
  return Response.ok(new LabelFields(labelFields)).cacheControl(NO_CACHE).build();
}
origin: com.atlassian.jira/jira-api

protected BooleanQuery generateRangeQueryForPredicate(final String fieldName, final Predicate<T> match)
{
  final Collection<T> domainObjects = resolver.getAll();
  BooleanQuery bq = new BooleanQuery();
  for (T indexedObject : CollectionUtil.filter(domainObjects, match))
  {
    bq.add(getTermQuery(fieldName, indexInfoResolver.getIndexedValue(indexedObject)), BooleanClause.Occur.SHOULD);
  }
  return bq;
}
origin: com.atlassian.jira/jira-core

private Collection<TaskDescriptor<?>> findTasksInternal(final TaskMatcher matcher)
{
  notNull("matcher", matcher);
  return toList(transform(filter(getTasks(taskMap), new TaskMatcherPredicate(matcher)),
      Functions.<TaskDescriptor<?>, TaskDescriptor<?>>coerceToSuper()));
}
origin: com.atlassian.jira/jira-api

  for (Version matchedVersion : CollectionUtil.filter(versionResolver.getAll(), predicate))
contextVersions = CollectionUtil.filter(versionResolver.getAll(), new Predicate<Version>()
origin: com.atlassian.jira/jira-core

  private JqlClauseBuilder getQueryForSubTasks(List<Issue> parentIssues, final boolean onlyIncludeUnresolved)
  {
    final List<Long> parentIssueIds = CollectionUtil.transform(
        CollectionUtil.filter(parentIssues, Predicates.notNull()), new Function<Issue, Long>()
    {
      public Long get(final Issue input)
      {
        return input.getId();
      }
    });
    JqlClauseBuilder builder = JqlQueryBuilder.newBuilder().where().issueParent().inNumbers(parentIssueIds);
    if (onlyIncludeUnresolved)
    {
      builder = builder.and().unresolved();
    }
    return builder;
  }
}
com.atlassian.jira.util.collectCollectionUtilfilter

Javadoc

Create a filtered Iterable.

Popular methods of CollectionUtil

  • copyAsImmutableList
    Return an immutable list copy of the passed collection.
  • transform
    Return a List that is transformed from elements of the input type to elements of the output type by
  • contains
    Does the supplied Iterator contain anything that matches the predicate?
  • foreach
    For each element in the iterator, consume the contents.
  • toList
    Turn the iterator into a list.
  • copyAsImmutableMap
    Return an immutable copy of the passed map. The type of the reurned map is not gaurenteed to match t
  • findFirstMatch
    Return the first found element that the predicate matches.
  • indexOf
    Returns the index of the first element that matches the predicate.
  • predicateAdapter
  • sort
    Copy and sort the passed collection and return an unmodifiable List of the elements.
  • toSet
    Turn the iterable into a Set.
  • transformIterator
    Return an Iterator that is transformed from elements of the input type to elements of the output typ
  • toSet,
  • transformIterator,
  • transformSet

Popular in Java

  • Creating JSON documents from java classes using gson
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JComboBox (javax.swing)
  • JTextField (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now