Skip to content

Commit

Permalink
Simplify Java streams usage
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Aug 26, 2024
1 parent 7b4aa0b commit 63940b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public static void setup(PolarisConnectionExtension.PolarisToken adminToken) {
@AfterEach
public void tearDown() {
try (Response response = newRequest("http://localhost:%d/api/management/v1/catalogs").get()) {
response.readEntity(Catalogs.class).getCatalogs().stream()
response
.readEntity(Catalogs.class)
.getCatalogs()
.forEach(
catalog ->
newRequest("http://localhost:%d/api/management/v1/catalogs/" + catalog.getName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.util.Set;
import java.util.UUID;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.iceberg.BaseTable;
import org.apache.iceberg.CatalogProperties;
Expand Down Expand Up @@ -1143,12 +1142,7 @@ private TableMetadata createSampleTableMetadata(String tableLocation) {
private void createNonExistingNamespaces(Namespace namespace) {
// Pre-create namespaces if they don't exist
for (int i = 1; i <= namespace.length(); i++) {
Namespace nsLevel =
Namespace.of(
Arrays.stream(namespace.levels())
.limit(i)
.collect(Collectors.toList())
.toArray(String[]::new));
Namespace nsLevel = Namespace.of(Arrays.copyOf(namespace.levels(), i));
if (!catalog.namespaceExists(nsLevel)) {
catalog.createNamespace(nsLevel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public void testListGrantsOnCatalogObjectsToCatalogRoles() {
tableGrant2,
viewGrant1,
viewGrant2);
role1Grants.stream().forEach(grant -> addGrant("catalogrole1", grant));
role1Grants.forEach(grant -> addGrant("catalogrole1", grant));
List<GrantResource> role2Grants =
List.of(
catalogGrant1,
Expand All @@ -491,7 +491,7 @@ public void testListGrantsOnCatalogObjectsToCatalogRoles() {
tableGrant3,
viewGrant1,
viewGrant3);
role2Grants.stream().forEach(grant -> addGrant("catalogrole2", grant));
role2Grants.forEach(grant -> addGrant("catalogrole2", grant));

// List grants for catalogrole1
try (Response response =
Expand Down

0 comments on commit 63940b2

Please sign in to comment.