How can I create a Stream<String[]> with only one element with Stream.of?
问题 Using Stream.of to create generic streams is very convenient, but what if I want to create a Stream<String[]> of only one element? Let’s say I have: String[] tropicalFruits = new String[] {"pineapple", "banana", "mango"}; String[] fruits = new String[] {"melon", "peach", "apple"}; Then Stream.of(tropicalFruits, fruits) produces a Stream<String[]> of two elements. How can I achieve the same for a stream of a single element? If I try: Stream<String[]> fruityStream = Stream.of(tropicalFruits); I