All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.randomdwi.polygonclipping.utils.ReaderUtil Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package com.github.randomdwi.polygonclipping.utils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class ReaderUtil {

    /**
     * Convert input string to integer.
     *
     * @param line input string
     * @return integer value
     */
    public static int toInt(String line) {
        return Integer.valueOf(line.trim());
    }

    /**
     * Convert input string to double list.
     *
     * @param line input string
     * @return double list
     */
    public static List toDoubleList(String line) {
        String[] parts = line.trim().split(" ");
        return Arrays.stream(parts).map(Double::valueOf).collect(Collectors.toList());
    }

    /**
     * Convert input string to integer list.
     *
     * @param line input string
     * @return integer list
     */
    public static List toIntegerList(String line) {
        String[] parts = line.trim().split(" ");
        return Arrays.stream(parts).map(Integer::valueOf).collect(Collectors.toList());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy