congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CollectionUtil
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: com.atlassian.jira/jira-core

/**
 * @return all the chunks in a single list
 */
public List<DiffChunk> getUnifiedChunks()
{
  return CollectionUtil.copyAsImmutableList(chunks);
}
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

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

/**
 * Return a List that is transformed from elements of the input type to elements of the output type by a transformer function.
 *
 * @param <T> the input type
 * @param <R> the out type
 * @param iterator to iterate over the contents
 * @param transformer the function that performs the transformation
 * @return an unmodifiable List of the transformed type
 */
public static <T, R> List<R> transform(@Nonnull final Iterator<? extends T> iterator, @Nonnull final Function<T, R> transformer)
{
  return toList(transformIterator(iterator, transformer));
}
origin: com.atlassian.jira/jira-core

void setProjectsWithBrowsePermission(final ApplicationUser user, final Collection<GenericValue> projectsWithBrowsePermission)
{
  //JRA-16757: Make an immutable copy of the returned list and return it. This will give a runtime exception anyone that is trying
  //to modify the list inline.
  final CacheKey cacheKey = new CacheKey(user);
  projectsWithBrowsePermissionForUser.put(cacheKey, CollectionUtil.copyAsImmutableList(projectsWithBrowsePermission));
  projectObjectsWithBrowsePermissionForUser.put(cacheKey, CollectionUtil.transform(projectsWithBrowsePermission, gvToProjectTransformer));
}
origin: com.atlassian.jira/jira-core

public static List<ProjectOption> transform(final Iterable<? extends Project> projects)
{
  return CollectionUtil.transform(projects, new Function<Project, ProjectOption>()
  {
    @Override
    public ProjectOption get(final Project input)
    {
      return new ProjectOption(input);
    }
  });
}
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-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-core

public void foreach(final Consumer<Issue> sink)
{
  CollectionUtil.foreach(new AbstractTransformIssueIterator<Long>(ids)
  {
    @Override
    protected Issue transform(final Long o)
    {
      return issueManager.getIssueObject(o);
    }
  }, sink);
}
origin: com.atlassian.jira/jira-core

@Override
@Nonnull
public Collection<IssueSearcher<?>> getSearchersByClauseName(final ApplicationUser user, final String jqlClauseName)
{
  notBlank("jqlClauseName", jqlClauseName);
  return toList(filter(transform(getHelper().getIssueSearcherRegistrationsByClauseName(jqlClauseName),
      new Function<SearcherRegistration, IssueSearcher<?>>()
      {
        @Override
        public IssueSearcher<?> get(final SearcherRegistration searcherRegistration)
        {
          return searcherRegistration.getIssueSearcher();
        }
      }), Predicates.<IssueSearcher<?>>notNull()));
}
origin: com.atlassian.jira/jira-api

/**
 * Turn the iterable into a list.
 *
 * @param <T> the element type
 * @param iterable to iterate over the elements
 * @return an unmodifiable {@link List} of the elements in the iterator
 */
public static <T> List<T> toList(@Nonnull final Iterable<? extends T> iterable)
{
  return toList(iterable.iterator());
}
origin: com.atlassian.jira/jira-core

/**
 * This will try to find an acceptable setter method for given parameter name
 *
 * @param paramName the parameter name
 * @param setterDescriptors the setters for this action
 * @return a valid setter method or null if one can be found
 */
private Method getSetterForParameter(final String paramName, final PropertyDescriptor[] setterDescriptors)
{
  // These have been sorted into a preferred order.  We pick the first one matches and
  // only the first one only. There is no retry if their happens to be more than one!
  final PropertyDescriptor descriptor = findFirstMatch(asList(setterDescriptors), new Predicate<PropertyDescriptor>()
  {
    public boolean evaluate(final PropertyDescriptor input)
    {
      return paramName.equals(input.getName());
    }
  });
  return (descriptor == null) ? null : descriptor.getWriteMethod();
}
origin: com.atlassian.jira/jira-api

public FieldConfigSchemeImpl(final Long id, final String fieldId, final String name, final String description, final Map<String, FieldConfig> configs, final FieldConfigContextPersister configContextPersister)
{
  this.id = id;
  this.fieldId = fieldId;
  this.name = StringUtils.abbreviate(name, FieldConfigPersister.ENTITY_LONG_TEXT_LENGTH);
  this.description = description;
  this.configs = (configs != null) ? CollectionUtil.copyAsImmutableMap(configs) : Collections.<String, FieldConfig> emptyMap();
  this.configContextPersister = configContextPersister;
}
origin: com.atlassian.jira/jira-core

int index = CollectionUtil.indexOf(issuesInPage, new Predicate<Issue>()
origin: com.atlassian.jira/jira-core

SelectedValues(Collection<String> selectedValues)
{
  this.selectedValuesInLowerCase = CollectionUtil.transform(selectedValues, new Function<String, String>()
  {
    @Override
    public String get(String value)
    {
      return value.toLowerCase();
    }
  });
}
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-core

void setProjectObjectsWithBrowsePermission(final ApplicationUser user, final Collection<Project> projectsWithBrowsePermission)
{
  //JRA-16757: Make an immutable copy of the returned list and return it. This will give a runtime exception anyone that is trying
  //to modify the list inline.
  final CacheKey cacheKey = new CacheKey(user);
  projectObjectsWithBrowsePermissionForUser.put(cacheKey, CollectionUtil.copyAsImmutableList(projectsWithBrowsePermission));
  projectsWithBrowsePermissionForUser.put(cacheKey, CollectionUtil.transform(projectsWithBrowsePermission, projectToGVTransformer));
}
origin: com.atlassian.jira/jira-core

public final void foreach(final Consumer<Issue> sink)
{
  CollectionUtil.foreach(new AbstractTransformIssueIterator<GenericValue>(issueGVs)
  {
    @Override
    protected Issue transform(final GenericValue o)
    {
      return issueFactory.getIssue(o);
    }
  }, sink);
}
origin: com.atlassian.jira/jira-api

/**
 * Turn the enumeration into a list.
 *
 * @param <T> the element type
 * @param enumeration to enumerate over the elements
 * @return an unmodifiable {@link List} of the elements in the iterator
 */
public static <T> List<T> toList(@Nonnull final Enumeration<? extends T> enumeration)
{
  return toList(fromEnumeration(enumeration));
}
origin: com.atlassian.jira/jira-core

public TaskDescriptor<?> findFirstTask(@Nonnull final TaskMatcher matcher)
{
  return findFirstMatch(getTasks(taskMap), new TaskMatcherPredicate(matcher));
}
com.atlassian.jira.util.collectCollectionUtil

Most used methods

  • copyAsImmutableList
    Return an immutable list copy of the passed collection.
  • filter
    Create a filtered Iterator.
  • 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.
  • sort,
  • toSet,
  • transformIterator,
  • transformSet

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JList (javax.swing)
  • Github Copilot alternatives
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