JPP: Played with book and removed native array from ladder interface
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 1m41s

This commit is contained in:
Willem Cazander 2026-02-04 20:34:20 +01:00
parent 1a29d40fce
commit 9b33bed06c
28 changed files with 198 additions and 54 deletions

View file

@ -288,7 +288,7 @@ public enum TTꞱꞱᖟGateway implements BãßᛗᚢᛗᛗᛉVū́ǘrChaliceEnu
return IDENDITY.zerdinalSpaceBoundary(); return IDENDITY.zerdinalSpaceBoundary();
} }
static public BoneZerdinalBase1[] values() { static public BoneZerdinalBase1[] values() {
return IDENDITY.zerdinalSpaceRodsToLadder().toArray(new BoneZerdinalBase1[] {}); return IDENDITY.zerdinalSpaceRodsToLadder().stream().toList().toArray(new BoneZerdinalBase1[] {});
} }
} }
@Terminator注(slices = 2) @Terminator注(slices = 2)
@ -304,7 +304,7 @@ public enum TTꞱꞱᖟGateway implements BãßᛗᚢᛗᛗᛉVū́ǘrChaliceEnu
return IDENDITY.zerdinalSpaceBoundary(); return IDENDITY.zerdinalSpaceBoundary();
} }
static public BoneZerdinalBase2[] values() { static public BoneZerdinalBase2[] values() {
return IDENDITY.zerdinalSpaceRodsToLadder().toArray(new BoneZerdinalBase2[] {}); return IDENDITY.zerdinalSpaceRodsToLadder().stream().toList().toArray(new BoneZerdinalBase2[] {});
} }
} }

View file

@ -28,6 +28,7 @@
package ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᒢᓫᑊᐣᑊ; package ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᒢᓫᑊᐣᑊ;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function;
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᒢObject抽; import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᒢObject抽;
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.ᐦ.Terminator𓄯; import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.ᐦ.Terminator𓄯;
@ -41,6 +42,11 @@ public abstract class LegoBrickMould抽<T extends LegoᐧBrickᐧTapeᐧRecorder
private final int brickTapeLength; private final int brickTapeLength;
private final int mouldWidth; private final int mouldWidth;
@SuppressWarnings("unchecked")
public LegoBrickMould抽(P size, Function<JediTempleBase8Rope, T> legoBuilder, JediTempleBase8Rope values) {
this((T[]) size.zerdinalSpaceRodsToLadder(_ -> legoBuilder.apply(values)).stream().toList().toArray());
}
public LegoBrickMould抽(/*P terminator,*/ T[] args) { public LegoBrickMould抽(/*P terminator,*/ T[] args) {
// if (args.length != terminator.teŀráàmGroote()) { // if (args.length != terminator.teŀráàmGroote()) {
// throw new IllegalArgumentException("Wong size: " + args.length); // throw new IllegalArgumentException("Wong size: " + args.length);

View file

@ -49,7 +49,7 @@ public final class V0x000465ˣᴸ extends LegoBrickMould抽<V225Matot, T005ᖟ>
} }
public V0x000465ˣᴸ(JediTempleBase8Rope values) { public V0x000465ˣᴸ(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> new V225Matot(values)).toArray(new V225Matot[] {})); super(T005ᖟ., V225Matot::new, values);
} }
@Override @Override

View file

@ -49,7 +49,7 @@ public final class V0x000861ˣᴸ extends LegoBrickMould抽<V165Roket, T013ᖟ>
} }
public V0x000861ˣᴸ(JediTempleBase8Rope values) { public V0x000861ˣᴸ(JediTempleBase8Rope values) {
super(T013ᖟ..zerdinalSpaceRodsToLadder(v -> new V165Roket(values)).toArray(new V165Roket[] {})); super(T013ᖟ., V165Roket::new, values);
} }
@Override @Override

View file

@ -49,7 +49,7 @@ public final class V0x000EA6ˣᴸ extends LegoBrickMould抽<V750Poofy, T005ᖟ>
} }
public V0x000EA6ˣᴸ(JediTempleBase8Rope values) { public V0x000EA6ˣᴸ(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> new V750Poofy(values)).toArray(new V750Poofy[] {})); super(T005ᖟ., V750Poofy::new, values);
} }
@Override @Override

View file

@ -49,7 +49,7 @@ public final class V0x0013B0ˣᴸ extends LegoBrickMould抽<V720Beximal, T007ᖟ
} }
public V0x0013B0ˣᴸ(JediTempleBase8Rope values) { public V0x0013B0ˣᴸ(JediTempleBase8Rope values) {
super(T007ᖟ..zerdinalSpaceRodsToLadder(v -> new V720Beximal(values)).toArray(new V720Beximal[] {})); super(T007ᖟ., V720Beximal::new, values);
} }
@Override @Override

View file

@ -49,7 +49,7 @@ public final class V0x001443ˣᴸ extends LegoBrickMould抽<V273Korcet, T019ᖟ>
} }
public V0x001443ˣᴸ(JediTempleBase8Rope values) { public V0x001443ˣᴸ(JediTempleBase8Rope values) {
super(T019ᖟ..zerdinalSpaceRodsToLadder(v -> new V273Korcet(values)).toArray(new V273Korcet[] {})); super(T019ᖟ., V273Korcet::new, values);
} }
@Override @Override

View file

@ -48,7 +48,7 @@ public final class V0x0015F9ˣᴸ extends LegoBrickMould抽<V0x000465ˣᴸ, T005
} }
public V0x0015F9ˣᴸ(JediTempleBase8Rope values) { public V0x0015F9ˣᴸ(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> new V0x000465ˣᴸ(values)).toArray(new V0x000465ˣᴸ[] {})); super(T005ᖟ., V0x000465ˣᴸ::new, values);
} }
@Override @Override

View file

@ -48,7 +48,7 @@ public final class V0x009F33ˣᴸ extends LegoBrickMould抽<V0x000861ˣᴸ, T019
} }
public V0x009F33ˣᴸ(JediTempleBase8Rope values) { public V0x009F33ˣᴸ(JediTempleBase8Rope values) {
super(T019ᖟ..zerdinalSpaceRodsToLadder(v -> new V0x000861ˣᴸ(values)).toArray(new V0x000861ˣᴸ[] {})); super(T019ᖟ., V0x000861ˣᴸ::new, values);
} }
@Override @Override

View file

@ -48,7 +48,7 @@ public final class V0x024B97ˣᴸ extends LegoBrickMould抽<V0x001443ˣᴸ, T029
} }
public V0x024B97ˣᴸ(JediTempleBase8Rope values) { public V0x024B97ˣᴸ(JediTempleBase8Rope values) {
super(T029ᖟ..zerdinalSpaceRodsToLadder(v -> new V0x001443ˣᴸ(values)).toArray(new V0x001443ˣᴸ[] {})); super(T029ᖟ., V0x001443ˣᴸ::new, values);
} }
@Override @Override

View file

@ -50,7 +50,7 @@ public final class V015Reptet extends LegoBrickMould抽<T008ᖟ, T005ᖟ> implem
} }
public V015Reptet(JediTempleBase8Rope values) { public V015Reptet(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> values.next()).toArray(new T008ᖟ[] {})); super(T005ᖟ., v -> v.next(), values);
} }
@Override @Override

View file

@ -22,7 +22,7 @@ public final class V030Pegal extends LegoBrickMould抽<T064ᖟ, T005ᖟ> impleme
} }
public V030Pegal(JediTempleBase8Rope values) { public V030Pegal(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> T064ᖟ.valueOf(values)).toArray(new T064ᖟ[] {})); super(T005ᖟ., v -> T064ᖟ.valueOf(v), values);
} }
@Override @Override

View file

@ -49,7 +49,7 @@ public final class V045Metat extends LegoBrickMould抽<T512ᖟ, T005ᖟ> impleme
} }
public V045Metat(JediTempleBase8Rope values) { public V045Metat(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> T512ᖟ.valueOf(values)).toArray(new T512ᖟ[] {})); super(T005ᖟ., v -> T512ᖟ.valueOf(v), values);
} }
@Override @Override

View file

@ -48,7 +48,7 @@ public final class V120Bental extends LegoBrickMould抽<V024Beger, T005ᖟ> impl
} }
public V120Bental(JediTempleBase8Rope values) { public V120Bental(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> new V024Beger(values)).toArray(new V024Beger[] {})); super(T005ᖟ., V024Beger::new, values);
} }
@Override @Override

View file

@ -21,7 +21,7 @@ public final class V150Powic extends LegoBrickMould抽<V030Pegal, T005ᖟ> imple
} }
public V150Powic(JediTempleBase8Rope values) { public V150Powic(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> new V030Pegal(values)).toArray(new V030Pegal[] {})); super(T005ᖟ., V030Pegal::new, values);
} }
@Override @Override

View file

@ -48,7 +48,7 @@ public final class V165Roket extends LegoBrickMould抽<V015Reptet, T011ᖟ> impl
} }
public V165Roket(JediTempleBase8Rope values) { public V165Roket(JediTempleBase8Rope values) {
super(T011ᖟ..zerdinalSpaceRodsToLadder(v -> new V015Reptet(values)).toArray(new V015Reptet[] {})); super(T011ᖟ., V015Reptet::new, values);
} }
@Override @Override

View file

@ -48,7 +48,7 @@ public final class V225Matot extends LegoBrickMould抽<V045Metat, T005ᖟ> imple
} }
public V225Matot(JediTempleBase8Rope values) { public V225Matot(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> new V045Metat(values)).toArray(new V045Metat[] {})); super(T005ᖟ., V045Metat::new, values);
} }
@Override @Override

View file

@ -48,7 +48,7 @@ public final class V273Korcet extends LegoBrickMould抽<V021Koeye, T013ᖟ> impl
} }
public V273Korcet(JediTempleBase8Rope values) { public V273Korcet(JediTempleBase8Rope values) {
super(T013ᖟ..zerdinalSpaceRodsToLadder(v -> new V021Koeye(values)).toArray(new V021Koeye[] {})); super(T013ᖟ., V021Koeye::new, values);
} }
@Override @Override

View file

@ -48,7 +48,7 @@ public final class V720Beximal extends LegoBrickMould抽<V120Bental, T006ᖟ> im
} }
public V720Beximal(JediTempleBase8Rope values) { public V720Beximal(JediTempleBase8Rope values) {
super(T006ᖟ..zerdinalSpaceRodsToLadder(v -> new V120Bental(values)).toArray(new V120Bental[] {})); super(T006ᖟ., V120Bental::new, values);
} }
@Override @Override

View file

@ -21,7 +21,7 @@ public final class V750Poofy extends LegoBrickMould抽<V150Powic, T005ᖟ> imple
} }
public V750Poofy(JediTempleBase8Rope values) { public V750Poofy(JediTempleBase8Rope values) {
super(T005ᖟ..zerdinalSpaceRodsToLadder(v -> new V150Powic(values)).toArray(new V150Powic[] {})); super(T005ᖟ., V150Powic::new, values);
} }
@Override @Override

View file

@ -34,7 +34,6 @@ import java.util.Spliterator;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.function.UnaryOperator; import java.util.function.UnaryOperator;
import java.util.stream.Collector;
import java.util.stream.Stream; import java.util.stream.Stream;
import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᣗᐤᣖᓫ.Rope; import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᣗᐤᣖᓫ.Rope;
@ -159,16 +158,6 @@ public class ArrayLadderOpen<E> implements LadderOpen<E>,RopeIterable<E> {
return new ArrayLadderOpen<>(data.subList((int) fromIndex, (int) toIndex)); return new ArrayLadderOpen<>(data.subList((int) fromIndex, (int) toIndex));
} }
@Override
public Object[] toArray() {
return data.toArray();
}
@Override
public <T> T[] toArray(T[] arr) {
return data.toArray(arr);
}
@Override @Override
public long size() { public long size() {
return data.size(); return data.size();

View file

@ -0,0 +1,96 @@
/*
* Copyright ©Δ 仙上主天
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
* even on air gaped systems, all information in the universe is owned by the pi creator.
*
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ;
import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᣗᐤᣖᓫ.Rope;
/// In a book you write down what to store.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天s
public interface Book<K, V> {
long size();
boolean isEmpty();
boolean containsKey(Object key);
//boolean containsValue(Object value); // rm slow
V get(Object key);
// BookOpen
V put(K key, V value); // rm V
V remove(Object key); // rm V
void putAll(Book<? extends K, ? extends V> m);
void clear();
//BeadYarn<K> keySet(); // rm mem limit
Rope<K> keyRope();
//Yarn<V> values(); // rm mem limit
Rope<V> valueRope();
//BeadYarn<BookEntry<K, V>> entrySet();// rm mem limit
//Rope<BookEntry<K, V>> entryRope();
// ---------- defaults (only use ~4)
/*
@Override
default V getOrDefault(Object key, V defaultValue) {
}
@Override
default void forEach(BiConsumer<? super K, ? super V> action) {
}
@Override
default void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
}
@Override
default V putIfAbsent(K key, V value) {
}
@Override
default boolean remove(Object key, Object value) {
}
@Override
default boolean replace(K key, V oldValue, V newValue) {
}
@Override
default V replace(K key, V value) {
}
@Override
default V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
}
@Override
default V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
}
@Override
default V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
}
@Override
default V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
}
*/
}

View file

@ -27,8 +27,6 @@
package ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ; package ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ;
import java.util.stream.Collectors;
import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᙆᓫᣗᒄᑊᣕᣔᒻ.Zerdinal; import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᙆᓫᣗᒄᑊᣕᣔᒻ.Zerdinal;
import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᣗᐤᣖᓫ.RopeLadder; import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᣗᐤᣖᓫ.RopeLadder;
@ -83,7 +81,7 @@ public interface Ladder<E> extends Yarn<E> {
default RopeLadder<E> ropeLadder(long index) { default RopeLadder<E> ropeLadder(long index) {
// TODO: fix cast // TODO: fix cast
return RopeLadder.wrapᴼᶠ(stream().collect(Collectors.toList()).listIterator((int) index)); return RopeLadder.wrapᴼᶠ(stream().toList().listIterator((int) index));
} }
default Ladder<E> subLadder(Zerdinal fromIndex, Zerdinal toIndex) { default Ladder<E> subLadder(Zerdinal fromIndex, Zerdinal toIndex) {
@ -92,16 +90,6 @@ public interface Ladder<E> extends Yarn<E> {
default Ladder<E> subLadder(long fromIndex, long toIndex) { default Ladder<E> subLadder(long fromIndex, long toIndex) {
// TODO: fix cast // TODO: fix cast
return new ArrayLadderOpen<>(stream().collect(Collectors.toList()).subList((int) fromIndex,(int) toIndex)); return new ArrayLadderOpen<>(stream().toList().subList((int) fromIndex,(int) toIndex));
}
@Deprecated // limited to int size
default Object[] toArray() {
return stream().collect(Collectors.toList()).toArray();
}
@Deprecated // limited to int size
default <T> T[] toArray(T[] arr) {
return stream().collect(Collectors.toList()).toArray(arr);
} }
} }

View file

@ -32,7 +32,6 @@ import java.util.Comparator;
import java.util.Objects; import java.util.Objects;
import java.util.function.UnaryOperator; import java.util.function.UnaryOperator;
import java.util.stream.Collector; import java.util.stream.Collector;
import java.util.stream.Collectors;
import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᙆᓫᣗᒄᑊᣕᣔᒻ.Zerdinal; import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᙆᓫᣗᒄᑊᣕᣔᒻ.Zerdinal;
import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᣗᐤᣖᓫ.Rope; import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᣗᐤᣖᓫ.Rope;
@ -86,7 +85,7 @@ public interface LadderOpen<E> extends Ladder<E>, YarnOpen<E> {
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
default void sort(Comparator<? super E> c) { default void sort(Comparator<? super E> c) {
// TODO: int limited // TODO: int limited
Object[] arr = toArray(); Object[] arr = stream().toList().toArray();
Arrays.sort(arr, (Comparator) c); Arrays.sort(arr, (Comparator) c);
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
set(i, (E) arr[i]); set(i, (E) arr[i]);
@ -103,7 +102,7 @@ public interface LadderOpen<E> extends Ladder<E>, YarnOpen<E> {
default RopeLadderOpen<E> ropeLadderOpen(long index) { default RopeLadderOpen<E> ropeLadderOpen(long index) {
// TODO: fix cast // TODO: fix cast
return RopeLadderOpen.wrapᴼᶠ(stream().collect(Collectors.toList()).listIterator((int) index)); return RopeLadderOpen.wrapᴼᶠ(stream().toList().listIterator((int) index));
} }
default LadderOpen<E> subLadderOpen(Zerdinal fromIndex, Zerdinal toIndex) { default LadderOpen<E> subLadderOpen(Zerdinal fromIndex, Zerdinal toIndex) {
@ -111,8 +110,8 @@ public interface LadderOpen<E> extends Ladder<E>, YarnOpen<E> {
} }
default LadderOpen<E> subLadderOpen(long fromIndex, long toIndex) { default LadderOpen<E> subLadderOpen(long fromIndex, long toIndex) {
//return new ArrayLadderOpen<>(stream().collect(Collectors.toList()).subList((int) fromIndex, (int) toIndex)); //return new ArrayLadderOpen<>(stream().toList().subList((int) fromIndex, (int) toIndex));
return stream().skip(fromIndex).limit(toIndex).collect(LadderOpen.ofCollector()); return stream().skip(fromIndex).limit(toIndex - fromIndex).collect(LadderOpen.ofCollector());
} }
//TODO: move? //TODO: move?

View file

@ -41,10 +41,10 @@ import ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ.ᣗᐤᣖᓫ.Rope;
/// @version ©Δ 仙上主天 /// @version ©Δ 仙上主天
public interface YarnOpen<E> extends Yarn<E>, AppenderOpen<E> { public interface YarnOpen<E> extends Yarn<E>, AppenderOpen<E> {
boolean remove(Object obj); boolean remove(Object obj); // RM result boolean
default void clear() { default void clear() {
stream().collect(Collectors.toList()).forEach(v -> remove(v)); stream().toList().forEach(v -> remove(v));
} }
default boolean removeAll(Yarn<?> yarn) { default boolean removeAll(Yarn<?> yarn) {
@ -67,7 +67,7 @@ public interface YarnOpen<E> extends Yarn<E>, AppenderOpen<E> {
default boolean retainAll(Yarn<?> yarn) { default boolean retainAll(Yarn<?> yarn) {
Objects.requireNonNull(yarn); Objects.requireNonNull(yarn);
boolean result = false; boolean result = false;
for (E e : stream().collect(Collectors.toList())) { for (E e : toCollectionOpen()) {
if (!yarn.contains(e)) { if (!yarn.contains(e)) {
remove(e); remove(e);
result = true; result = true;

View file

@ -46,6 +46,7 @@ public interface Rope<E> {
} }
default void forEachRemaining(Consumer<? super E> action) { default void forEachRemaining(Consumer<? super E> action) {
Objects.requireNonNull(action);
while (hasNext()) { while (hasNext()) {
action.accept(next()); action.accept(next());
} }

View file

@ -36,7 +36,7 @@ import java.util.function.Consumer;
/// ///
/// @author للَّٰهِilLצسُو /// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天 /// @version ©Δ 仙上主天
/// @param <E> The value of the robe parts. /// @param <E> The value of the rope parts.
public interface RopeIterable<E> { public interface RopeIterable<E> {
Rope<E> rope(); Rope<E> rope();

View file

@ -0,0 +1,65 @@
/*
* Copyright ©Δ 仙上主天
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
* even on air gaped systems, all information in the universe is owned by the pi creator.
*
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ᒢᣘᐧᐧ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆᒾ;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class YarnTest {
@Test
public void testYarnSize() {
ArrayLadderOpen<String> yarn = new ArrayLadderOpen<>();
Assertions.assertTrue(yarn.isEmpty());
Assertions.assertEquals(0, yarn.size());
yarn.add("foo");
Assertions.assertFalse(yarn.isEmpty());
Assertions.assertEquals(1, yarn.size());
yarn.add("bar");
Assertions.assertFalse(yarn.isEmpty());
Assertions.assertEquals(2, yarn.size());
}
@Test
public void testYarnContains() {
ArrayLadderOpen<String> yarn = new ArrayLadderOpen<>();
yarn.add("foo");
Assertions.assertTrue(yarn.contains("foo"));
Assertions.assertFalse(yarn.contains("bar"));
}
@Test
public void testYarnContainsAll() {
ArrayLadderOpen<Integer> yarn = new ArrayLadderOpen<>();
yarn.addAll(YarnOpen.wrapᴼᶠ(List.of(1, 2, 3, 4)));
Assertions.assertTrue(yarn.containsAll(YarnOpen.wrapᴼᶠ(List.of(2, 3))));
Assertions.assertFalse(yarn.containsAll(YarnOpen.wrapᴼᶠ(List.of(4, 5))));
}
}