Codota Logo
Snippets.anagrams
Code IndexAdd Codota to your IDE (free)

How to use
anagrams
method
in
snippets.Snippets

Best Java code snippets using snippets.Snippets.anagrams (Showing top 2 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: biezhi/30-seconds-of-java8

public static List<String> anagrams(String input) {
  if (input.length() <= 2) {
    return input.length() == 2
        ? Arrays.asList(input, input.substring(1) + input.substring(0, 1))
        : Collections.singletonList(input);
  }
  return IntStream.range(0, input.length())
      .mapToObj(i -> new SimpleEntry<>(i, input.substring(i, i + 1)))
      .flatMap(entry ->
          anagrams(input.substring(0, entry.getKey()) + input.substring(entry.getKey() + 1))
              .stream()
              .map(s -> entry.getValue() + s))
      .collect(Collectors.toList());
}
origin: shekhargulati/30-seconds-of-java

public static List<String> anagrams(String input) {
  if (input.length() <= 2) {
    return input.length() == 2
        ? Arrays.asList(input, input.substring(1) + input.substring(0, 1))
        : Collections.singletonList(input);
  }
  return IntStream.range(0, input.length())
      .mapToObj(i -> new SimpleEntry<>(i, input.substring(i, i + 1)))
      .flatMap(entry ->
          anagrams(input.substring(0, entry.getKey()) + input.substring(entry.getKey() + 1))
              .stream()
              .map(s -> entry.getValue() + s))
      .collect(Collectors.toList());
}
snippetsSnippetsanagrams

Popular methods of Snippets

  • capitalize
  • deepFlatten
    Deep flattens an array.
  • flattenDepth
    Flattens an array up to the specified depth.
  • gcd
    Calculates the greatest common denominator (gcd) of an array of numbers
  • getAllInterfaces
  • indexOf
    Find index of element in the array. Return -1 in case element does not exist. Uses IntStream.range(
  • join
  • lastIndexOf
    Find last index of element in the array. Return -1 in case element does not exist. Uses IntStream.it

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • onRequestPermissionsResult (Fragment)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JOptionPane (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now