mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 00:09:31 +01:00
BitcoinNetwork: add strings()
method to list names of all values
This simplifies code that needs a list of all the values.
This commit is contained in:
parent
298a75808e
commit
8dd7b3e0b8
1 changed files with 10 additions and 0 deletions
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.bitcoinj.base.Coin.COIN;
|
||||
|
@ -202,6 +203,15 @@ public enum BitcoinNetwork implements Network {
|
|||
.findFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list of the names of all instances of this enum
|
||||
*/
|
||||
public static List<String> strings() {
|
||||
return stream()
|
||||
.map(BitcoinNetwork::toString)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return stream of all instances of this enum
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue