001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.tools; 003 004import java.util.Arrays; 005import java.util.List; 006import java.util.stream.Collectors; 007 008/** 009 * Utility methods for arrays. 010 * @since 15226 011 */ 012public final class ArrayUtils { 013 014 /** 015 * Utility class 016 */ 017 private ArrayUtils() { 018 // Hide default constructor for utility classes 019 } 020 021 /** 022 * Converts an array of int to a list of Integer. 023 * @param array array of int 024 * @return list of Integer 025 */ 026 public static List<Integer> toList(int[] array) { 027 return Arrays.stream(array).boxed().collect(Collectors.toList()); 028 } 029 030 /** 031 * Converts an array of long to a list of Long. 032 * @param array array of long 033 * @return list of Long 034 */ 035 public static List<Long> toList(long[] array) { 036 return Arrays.stream(array).boxed().collect(Collectors.toList()); 037 } 038 039 /** 040 * Converts an array of double to a list of Double. 041 * @param array array of double 042 * @return list of Double 043 */ 044 public static List<Double> toList(double[] array) { 045 return Arrays.stream(array).boxed().collect(Collectors.toList()); 046 } 047}