File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
core-api/src/main/java/com/bloxbean/cardano/client/api Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 99 * UtxoSelectionStrategy implementation.
1010 */
1111public interface AddressIterator extends Iterator <Address > {
12+
13+ /**
14+ * Retrieves the first address in the iterator's list of addresses without moving the cursor.
15+ *
16+ * @return the first {@link Address} in the list, or null if the list is empty.
17+ */
18+ Address getFirst ();
19+
1220 /**
1321 * Reset the pointer to the beginning
1422 */
1523 void reset ();
1624
25+ /**
26+ * Creates and returns a copy of this AddressIterator.
27+ * The cloned instance is independent of the original and can be used separately.
28+ *
29+ * @return a new AddressIterator instance that is a copy of the current iterator.
30+ */
31+ AddressIterator clone ();
32+
1733}
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ public static AddressIterator of(Address address) {
1212 return new SingleAddressIterator (address );
1313 }
1414
15+ public static AddressIterator of (String address ) {
16+ return new SingleAddressIterator (new Address (address ));
17+ }
18+
1519 static class SingleAddressIterator implements AddressIterator {
1620 private Address address ;
1721 private Iterator <Address > iterator ;
@@ -31,9 +35,19 @@ public Address next() {
3135 return iterator .next ();
3236 }
3337
38+ @ Override
39+ public Address getFirst () {
40+ return address ;
41+ }
42+
3443 @ Override
3544 public void reset () {
3645 this .iterator = List .of (address ).iterator ();
3746 }
47+
48+ @ Override
49+ public AddressIterator clone () {
50+ return new SingleAddressIterator (address );
51+ }
3852 }
3953}
You can’t perform that action at this time.
0 commit comments