Codota Logo
Snippets.deepFlatten
Code IndexAdd Codota 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)

  • 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

/**
 * 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

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • Table (org.hibernate.mapping)
    A relational table
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
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