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

How to use
deepFlatten
method
in
snippets.Snippets

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

origin: biezhi/30-seconds-of-java8

/**
 * Deep flattens an array.
 *
 * @param input A nested array containing integers
 * @return flattened array
 */
public static int[] deepFlatten(Object[] input) {
  return Arrays.stream(input)
      .flatMapToInt(o -> {
        if (o instanceof Object[]) {
          return Arrays.stream(deepFlatten((Object[]) o));
        }
        return IntStream.of((Integer) o);
      }).toArray();
}
origin: shekhargulati/30-seconds-of-java

/**
 * Deep flattens an array.
 *
 * @param input A nested array containing integers
 * @return flattened array
 */
public static int[] deepFlatten(Object[] input) {
  return Arrays.stream(input)
      .flatMapToInt(o -> {
        if (o instanceof Object[]) {
          return Arrays.stream(deepFlatten((Object[]) o));
        }
        return IntStream.of((Integer) o);
      }).toArray();
}
snippetsSnippetsdeepFlatten

Javadoc

Deep flattens an array.

Popular methods of Snippets

  • anagrams
  • capitalize
  • 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

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSystemService (Context)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Permission (java.security)
    Legacy security code; do not use.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Top Vim plugins
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