@@ -71,6 +71,14 @@ public Chain<List<T>> dropWhile(final Predicate<T> pred) {
7171 public Chain <List <T >> dropRightWhile (final Predicate <T > pred ) {
7272 return new Chain <List <T >>($ .dropRightWhile (value (), pred ));
7373 }
74+
75+ public Chain <List <Object >> fill (Object value ) {
76+ return new Chain <List <Object >>($ .fill ((List <Object >) value (), value ));
77+ }
78+
79+ public Chain <List <Object >> fill (Object value , Integer start , Integer end ) {
80+ return new Chain <List <Object >>($ .fill ((List <Object >) value (), value , start , end ));
81+ }
7482 }
7583
7684 public static Chain chain (final String item ) {
@@ -145,14 +153,35 @@ public List<T> dropWhile(final Predicate<T> pred) {
145153 }
146154
147155 public static <T > List <T > dropRightWhile (final Iterable <T > iterable , final Predicate <T > pred ) {
148- final List <T > list = reverse (iterable );
149- return rest (list , findIndex (list , negate (pred )));
156+ return dropWhile (reverse (iterable ), pred );
150157 }
151158
152159 public List <T > dropRightWhile (final Predicate <T > pred ) {
153160 return dropRightWhile (getIterable (), pred );
154161 }
155162
163+ public static List <Object > fill (final List <Object > list , Object value ) {
164+ for (int index = 0 ; index < list .size (); index += 1 ) {
165+ list .set (index , value );
166+ }
167+ return list ;
168+ }
169+
170+ public List <Object > fill (Object value ) {
171+ return fill ((List <Object >) getIterable (), value );
172+ }
173+
174+ public static List <Object > fill (final List <Object > list , Object value , Integer start , Integer end ) {
175+ for (int index = start ; index < end ; index += 1 ) {
176+ list .set (index , value );
177+ }
178+ return list ;
179+ }
180+
181+ public List <Object > fill (Object value , Integer start , Integer end ) {
182+ return fill ((List <Object >) getIterable (), value , start , end );
183+ }
184+
156185 public static void main (String ... args ) {
157186 final String message = "Underscore-java-lodash is a lodash plugin for underscore-java.\n \n "
158187 + "For docs, license, tests, and downloads, see: http://javadev.github.io/underscore-java" ;
0 commit comments