001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.lang3.stream; 018 019import java.util.stream.IntStream; 020 021/** 022 * Factory for {@link IntStream}. 023 * <p> 024 * <small> Only a factory for now but could hold other functionality.</small> 025 * </p> 026 * 027 * @since 3.13.0 028 */ 029public class IntStreams { 030 031 /** 032 * Shorthand for {@code IntStream.range(0, i)}. 033 * 034 * @param endExclusive the exclusive upper bound. 035 * @return a sequential {@link IntStream} for the range of {@code int} elements. 036 */ 037 public static IntStream range(final int endExclusive) { 038 return IntStream.range(0, endExclusive); 039 } 040 041 /** 042 * Shorthand for {@code IntStream.rangeClosed(0, i)}. 043 * 044 * @param endInclusive the inclusive upper bound. 045 * @return a sequential {@link IntStream} for the range of {@code int} elements. 046 */ 047 public static IntStream rangeClosed(final int endInclusive) { 048 return IntStream.rangeClosed(0, endInclusive); 049 } 050 051 /** 052 * Make private in 4.0. 053 * 054 * @deprecated TODO Make private in 4.0. 055 */ 056 @Deprecated 057 public IntStreams() { 058 // empty 059 } 060}