Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
refactor: create the join string by Stream's Collectors.join() method
Browse files Browse the repository at this point in the history
  • Loading branch information
flyisland committed Nov 7, 2021
1 parent e0ebd80 commit 3402a97
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ private StringBuilder childrenToJsonString(int level) {
* @return the obj-id
*/
public String getObjectId() {
var idList = sempSpec.getAttributeNames(AttributeType.IDENTIFYING).stream()
var result = sempSpec.getAttributeNames(AttributeType.IDENTIFYING).stream()
// Identifying attributes might not be required attributes, like "/msgVpns/bridges/remoteMsgVpns"
// If an identifying attribues is absent, use a empty string
.map(id -> Optional.ofNullable(attributes.get(id)).orElse("").toString())
.map(ConfigObject::percentEncoding)
.collect(Collectors.toList());
return String.join(",", idList);
.collect(Collectors.joining(","));
return result;
}

static String percentEncoding(String input){
Expand Down

0 comments on commit 3402a97

Please sign in to comment.