Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc382e15

Browse files
committed
Add Tuple2::init and fix javadocs
1 parentaf80d80 commitc382e15

File tree

8 files changed

+28
-23
lines changed

8 files changed

+28
-23
lines changed

‎src/main/java/com/jnape/palatable/lambda/adt/hlist/Tuple2.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ AppTrav extends Applicative<TravB, App>> AppTrav traverse(
237237
returnfn.apply(_2).fmap(_2Prime ->fmap(constantly(_2Prime))).<TravB>fmap(Applicative::coerce).coerce();
238238
}
239239

240+
/**
241+
* Returns a {@link SingletonHList}&lt;_1&gt; of the 1st element
242+
*
243+
* @return The {@link SingletonHList}&lt;_1&gt;
244+
*/
245+
publicSingletonHList<_1>init() {
246+
returninvert().tail();
247+
}
248+
240249
/**
241250
* Static factory method for creating <code>Tuple2</code>s from {@link java.util.Map.Entry}s.
242251
*

‎src/main/java/com/jnape/palatable/lambda/adt/hlist/Tuple3.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ AppTrav extends Applicative<TravB, App>> AppTrav traverse(
220220
}
221221

222222
/**
223-
* Returns aTupleof all the elements of thisTuple except the last
223+
* Returns a{@link Tuple2}&lt;_1, _2&gt;of all the elements of this{@link Tuple3}&lt;_1, _2, _3&gt; except the last
224224
*
225-
* @return TheTuple representing all but the last element
225+
* @return The{@link Tuple2}&lt;_1, _2&gt; representing all but the last element
226226
*/
227227
publicTuple2<_1,_2>init() {
228228
returnrotateR3().tail();

‎src/main/java/com/jnape/palatable/lambda/adt/hlist/Tuple4.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ AppTrav extends Applicative<TravB, App>> AppTrav traverse(
247247
}
248248

249249
/**
250-
* Returns aTupleof all the elements of thisTuple except the last
250+
* Returns a{@link Tuple3}&lt;_1, _2, _3&gt;of all the elements of this{@link Tuple4}&lt;_1, _2, _3, _4&gt; except the last
251251
*
252-
* @return TheTuple representing all but the last element
252+
* @return The{@link Tuple3}&lt;_1, _2, _3&gt; representing all but the last element
253253
*/
254254
publicTuple3<_1,_2,_3>init() {
255255
returnrotateR4().tail();

‎src/main/java/com/jnape/palatable/lambda/adt/hlist/Tuple5.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ AppTrav extends Applicative<TravB, App>> AppTrav traverse(
274274
}
275275

276276
/**
277-
* Returns aTupleof all the elements of thisTuple except the last
277+
* Returns a{@link Tuple4}&lt;_1, _2, _3, _4&gt;of all the elements of this{@link Tuple5}&lt;_1, _2, _3, _4, _5&gt; except the last
278278
*
279-
* @return TheTuple representing all but the last element
279+
* @return The{@link Tuple4}&lt;_1, _2, _3, _4&gt; representing all but the last element
280280
*/
281281
publicTuple4<_1,_2,_3,_4>init() {
282282
returnrotateR5().tail();

‎src/main/java/com/jnape/palatable/lambda/adt/hlist/Tuple6.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,9 @@ AppTrav extends Applicative<TravB, App>> AppTrav traverse(
305305
}
306306

307307
/**
308-
* Returns aTupleof all the elements of thisTuple except the last
308+
* Returns a{@link Tuple5}&lt;_1, _2, _3, _4, _5&gt;of all the elements of this{@link Tuple6}&lt;_1, _2, _3, _4, _5, _6&gt; except the last
309309
*
310-
* @return TheTuple representing all but the last element
310+
* @return The{@link Tuple5}&lt;_1, _2, _3, _4, _5&gt; representing all but the last element
311311
*/
312312
publicTuple5<_1,_2,_3,_4,_5>init() {
313313
returnrotateR6().tail();

‎src/main/java/com/jnape/palatable/lambda/adt/hlist/Tuple7.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ AppTrav extends Applicative<TravB, App>> AppTrav traverse(
335335
}
336336

337337
/**
338-
* Returns aTupleof all the elements of thisTuple except the last
338+
* Returns a{@link Tuple6}&lt;_1, _2, _3, _4, _5, _6&gt;of all the elements of this{@link Tuple7}&lt;_1, _2, _3, _4, _5, _6, _7&gt; except the last
339339
*
340-
* @return TheTuple representing all but the last element
340+
* @return The{@link Tuple6}&lt;_1, _2, _3, _4, _5, _6&gt; representing all but the last element
341341
*/
342342
publicTuple6<_1,_2,_3,_4,_5,_6>init() {
343343
returnrotateR7().tail();

‎src/main/java/com/jnape/palatable/lambda/adt/hlist/Tuple8.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ AppTrav extends Applicative<TravB, App>> AppTrav traverse(
365365
}
366366

367367
/**
368-
* Returns aTupleof all the elements of thisTuple except the last
368+
* Returns a{@link Tuple7}&lt;_1, _2, _3, _4, _5, _6, _7&gt;of all the elements of this{@link Tuple8}&lt;_1, _2, _3, _4, _5, _6, _7, _8&gt; except the last
369369
*
370-
* @return TheTuple representing all but the last element
370+
* @return The{@link Tuple7}&lt;_1, _2, _3, _4, _5, _6, _7&gt; representing all but the last element
371371
*/
372372
publicTuple7<_1,_2,_3,_4,_5,_6,_7>init() {
373373
returnrotateR8().tail();

‎src/test/java/com/jnape/palatable/lambda/adt/hlist/Tuple2Test.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66
importorg.junit.Before;
77
importorg.junit.Test;
88
importorg.junit.runner.RunWith;
9-
importtestsupport.traits.ApplicativeLaws;
10-
importtestsupport.traits.BifunctorLaws;
11-
importtestsupport.traits.FunctorLaws;
12-
importtestsupport.traits.MonadLaws;
13-
importtestsupport.traits.MonadRecLaws;
14-
importtestsupport.traits.MonadWriterLaws;
15-
importtestsupport.traits.TraversableLaws;
9+
importtestsupport.traits.*;
1610

1711
importjava.util.HashMap;
1812
importjava.util.Map;
@@ -26,10 +20,7 @@
2620
importstaticjava.util.Collections.emptyList;
2721
importstaticjava.util.Collections.singletonList;
2822
importstaticorg.junit.Assert.assertEquals;
29-
importstaticorg.mockito.Mockito.only;
30-
importstaticorg.mockito.Mockito.spy;
31-
importstaticorg.mockito.Mockito.verify;
32-
importstaticorg.mockito.Mockito.verifyNoMoreInteractions;
23+
importstaticorg.mockito.Mockito.*;
3324

3425
@RunWith(Traits.class)
3526
publicclassTuple2Test {
@@ -63,6 +54,11 @@ public void tail() {
6354
assertEquals(newSingletonHList<>(2),tuple2.tail());
6455
}
6556

57+
@Test
58+
publicvoidinit() {
59+
assertEquals(newSingletonHList<>(1),tuple2.init());
60+
}
61+
6662
@Test
6763
publicvoidcons() {
6864
assertEquals(newTuple3<>(0,tuple2),tuple2.cons(0));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp