Tabnine Logo
Functions$Function1
Code IndexAdd Tabnine to your IDE (free)

How to use
Functions$Function1
in
org.eclipse.xtext.xbase.lib

Best Java code snippets using org.eclipse.xtext.xbase.lib.Functions$Function1 (Showing top 20 results out of 315)

origin: org.eclipse.xtend/org.eclipse.xtend.core

protected String getMessageWithReducedStackTrace(final Throwable t, final Function1<? super Throwable, ? extends String> getMessage) {
 final StackTraceElement[] stackTrace = t.getStackTrace();
 final ArrayList<StackTraceElement> reducedStackTrace = CollectionLiterals.<StackTraceElement>newArrayList();
 for (final StackTraceElement it : stackTrace) {
  {
   if ((it.getClassName().contains(AnnotationProcessor.class.getName()) || 
    it.getClassName().contains(ProblemSupportImpl.class.getName()))) {
    try {
     t.setStackTrace(((StackTraceElement[])Conversions.unwrapArray(reducedStackTrace, StackTraceElement.class)));
     return getMessage.apply(t);
    } finally {
     t.setStackTrace(stackTrace);
    }
   }
   reducedStackTrace.add(it);
  }
 }
 return getMessage.apply(t);
}

origin: org.eclipse.xtend/org.eclipse.xtend.core

public void appendModifiers(final ASTNode node, final Iterable<IExtendedModifier> ext, final Function1<? super ASTNode, ? extends StringBuffer> callBack) {
 final Procedure1<IExtendedModifier> _function = (IExtendedModifier p) -> {
  ((ASTNode) p).accept(this);
 };
 final Procedure1<IExtendedModifier> appender = _function;
 final Function1<IExtendedModifier, Boolean> _function_1 = (IExtendedModifier it) -> {
  return Boolean.valueOf((it.isAnnotation() && (!Objects.equal(((Annotation) it).getTypeName().toString(), "Override"))));
 };
 IterableExtensions.<IExtendedModifier>forEach(IterableExtensions.<IExtendedModifier>filter(ext, _function_1), appender);
 if ((callBack != null)) {
  callBack.apply(node);
 }
 final Function1<IExtendedModifier, Boolean> _function_2 = (IExtendedModifier it) -> {
  return Boolean.valueOf((it.isModifier() && (!Objects.equal(((Modifier) it).getKeyword().toString(), "default"))));
 };
 IterableExtensions.<IExtendedModifier>forEach(IterableExtensions.<IExtendedModifier>filter(ext, _function_2), appender);
}

origin: at.bestsolution.efxclipse.eclipse/org.eclipse.xtext.xbase.lib

  @Override
  protected T computeNext() {
    while (!headFound) {
      if (!iterator.hasNext())
        return endOfData();
      T next = iterator.next();
      if (!predicate.apply(next)) {
        headFound = true;
        return next;
      }
    }
    if (iterator.hasNext()) {
      return iterator.next();
    } else {
      return endOfData();
    }
  }
};
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.xtext.xbase.lib

/**
 * Returns {@code true} if one or more elements in {@code iterator} satisfy the predicate.
 * 
 * @param iterator
 *            the iterator. May not be <code>null</code>.
 * @param predicate
 *            the predicate. May not be <code>null</code>.
 * @return <code>true</code> if one or more elements in {@code iterator} satisfy the predicate.
 */
public static <T> boolean exists(Iterator<T> iterator, Function1<? super T, Boolean> predicate) {
  if (predicate == null)
    throw new NullPointerException("predicate");
  while(iterator.hasNext()) {
    if (predicate.apply(iterator.next()))
      return true;
  }
  return false;
}
origin: org.eclipse.xtext/org.eclipse.xtext.xbase.lib

  @Override
  protected T computeNext() {
    while (!headFound) {
      if (!iterator.hasNext())
        return endOfData();
      T next = iterator.next();
      if (!predicate.apply(next)) {
        headFound = true;
        return next;
      }
    }
    if (iterator.hasNext()) {
      return iterator.next();
    } else {
      return endOfData();
    }
  }
};
origin: org.eclipse.xtext/org.eclipse.xtext.xbase.lib

/**
 * Returns {@code true} if one or more elements in {@code iterator} satisfy the predicate.
 * 
 * @param iterator
 *            the iterator. May not be <code>null</code>.
 * @param predicate
 *            the predicate. May not be <code>null</code>.
 * @return <code>true</code> if one or more elements in {@code iterator} satisfy the predicate.
 */
public static <T> boolean exists(Iterator<T> iterator, Function1<? super T, Boolean> predicate) {
  if (predicate == null)
    throw new NullPointerException("predicate");
  while(iterator.hasNext()) {
    if (predicate.apply(iterator.next()))
      return true;
  }
  return false;
}
origin: org.eclipse.xtend/org.eclipse.xtend.core

private <T extends Object> T recursiveFindType(final String qualifiedName, final Iterable<? extends T> typeDeclarations, final Function1<? super T, ? extends String> qualifiedNameProvider, final Function1<? super T, ? extends Iterable<? extends T>> subTypeProvider) {
 final char dot = '.';
 for (final T type : typeDeclarations) {
  {
   final String name = qualifiedNameProvider.apply(type);
   boolean _equals = Objects.equal(qualifiedName, name);
   if (_equals) {
    return type;
   }
   if ((qualifiedName.startsWith(name) && (qualifiedName.charAt(name.length()) == dot))) {
    return this.<T>recursiveFindType(qualifiedName, subTypeProvider.apply(type), qualifiedNameProvider, subTypeProvider);
   }
  }
 }
 return null;
}

origin: org.testeditor/org.testeditor.dsl.common

/**
 * return the index (0-based) of the first element that satisfies the predicate. -1 if not found.
 */
public <A extends Object> int indexOfFirst(final Iterable<A> iterable, final Function1<? super A, ? extends Boolean> predicate) {
 final Function1<Pair<Integer, A>, Boolean> _function = (Pair<Integer, A> it) -> {
  return predicate.apply(it.getValue());
 };
 Pair<Integer, A> _findFirst = IterableExtensions.<Pair<Integer, A>>findFirst(IterableExtensions.<A>indexed(iterable), _function);
 Integer _key = null;
 if (_findFirst!=null) {
  _key=_findFirst.getKey();
 }
 return (Optional.<Integer>ofNullable(_key).orElse(Integer.valueOf((-1)))).intValue();
}

origin: org.eclipse.xtext/org.eclipse.xtext.xbase.testing

public <P,T> T invoke1WithSuperAndExtends(Functions.Function1<? super P,? extends T> fun, P p1) {
  return fun.apply(p1);
}

origin: org.eclipse.xtext/org.eclipse.xtext.xbase.testing

public <P,T> T invoke1WithExtends(Functions.Function1<P, ? extends T> fun, P p1) {
  return fun.apply(p1);
}

origin: org.eclipse.xtext/org.eclipse.xtext.xbase.testing

public <P,T> T invoke1WithSuper(Functions.Function1<? super P,T> fun, P p1) {
  return fun.apply(p1);
}

origin: org.eclipse.xtext/org.eclipse.xtext.xbase.testing

public <P,T> T invoke1(Functions.Function1<P, T> fun, P p1) {
  return fun.apply(p1);
}

origin: sebastianbenz/Jnario

public static <T> boolean should_be(T obj, Functions.Function1<T, Boolean> func){
  return func.apply(obj);
}
 
origin: org.eclipse.xtend/org.eclipse.xtend.core

private <IN extends Object, OUT extends Object> OUT getOrCreate(final IN in, final Function1<? super IN, ? extends OUT> provider) {
 this.checkCanceled();
 if ((in == null)) {
  return null;
 }
 boolean _containsKey = this.identityCache.containsKey(in);
 if (_containsKey) {
  Object _get = this.identityCache.get(in);
  return ((OUT) _get);
 }
 final OUT result = provider.apply(in);
 this.identityCache.put(in, result);
 return result;
}

origin: io.typefox.lsapi/io.typefox.lsapi.services

@Deprecated
public void setResponseMethodResolver(final Function1<? super String, ? extends String> responseMethodResolver) {
 MethodResolver _xifexpression = null;
 if ((responseMethodResolver == null)) {
  _xifexpression = null;
 } else {
  final MethodResolver _function = (String it) -> {
   return responseMethodResolver.apply(it);
  };
  _xifexpression = _function;
 }
 this.methodResolver = _xifexpression;
}

origin: at.bestsolution.efxclipse.eclipse/org.eclipse.xtext.xbase.lib

  @Override
  public int compare(T a, T b) {
    C c1 = keyFunction.apply(a);
    C c2 = keyFunction.apply(b);
    if (c1 == c2) {
      return 0;
    } else if (c1 != null) {
      return c1.compareTo(c2);
    } else {
      return -c2.compareTo(c1);
    }
  }
}
origin: org.eclipse.xtext/org.eclipse.xtext.xbase.lib

  @Override
  public int compare(T a, T b) {
    C c1 = keyFunction.apply(a);
    C c2 = keyFunction.apply(b);
    if (c1 == c2) {
      return 0;
    } else if (c1 != null) {
      return c1.compareTo(c2);
    } else {
      return -c2.compareTo(c1);
    }
  }
}
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.xtext.xbase.lib

  @Override
  public R apply(V v) {
    return after.apply(before.apply(v));
  }
};
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.xtext.xbase.lib

  @Override
  public RESULT apply() {
    return function.apply(argument);
  }
};
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.xtext.xbase.lib

  @Override
  protected T computeNext() {
    if (!iterator.hasNext())
      return endOfData();
    T next = iterator.next();
    if (predicate.apply(next)) {
      return next;
    } else {
      return endOfData();
    }
  }
};
org.eclipse.xtext.xbase.libFunctions$Function1

Javadoc

A function that takes one argument.

Most used methods

  • apply

Popular in Java

  • Making http requests using okhttp
  • requestLocationUpdates (LocationManager)
  • putExtra (Intent)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • 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