[Question] How to effectively convert a list of list of lists of string into an array of arrays of arrays of string in Java>8

Remi Forax forax at univ-mlv.fr
Mon May 30 21:44:00 UTC 2022


Hi Sam, wrong list, 
openjdk.org is about people implementing the JDK, it's not a helping forum about how to do funny things in Java.

Stackoverflow.com is a better web site for the kind of questions you are asking.

reards,
Rémi

  public static List<List<List<String>>> wrap(String[][][] array) {
    return new AbstractList<>() {
      @Override
      public List<List<String>> get(int index) {
        var item = array[index];
        return new AbstractList<>() {
          @Override
          public List<String> get(int index) {
            var item2 = item[index];
            return new AbstractList<>() {
              @Override
              public String get(int index) {
                return item2[index];
              }

              @Override
              public int size() {
                return item2.length;
              }
            };
          }

          @Override
          public int size() {
            return item.length;
          }
        };
      }

      @Override
      public int size() {
        return array.length;
      }
    };
  }



----- Original Message -----
> From: "sam smith" <qustacksm2123456 at gmail.com>
> To: "discuss" <discuss at openjdk.java.net>
> Sent: Monday, May 30, 2022 11:14:52 PM
> Subject: [Question] How to effectively convert a list of list of lists of string into an array of arrays of arrays of
> string in Java>8

> Hello guys,
> 
> Let's say i have a List<List<List<String>>> that i want to convert into a
> String[][][]; how to do that effectively in Java versions greater that 8?
> 
> Thanks.


More information about the discuss mailing list