public static void deleteExistingFeatureGroups()

in Java/src/main/java/com/example/customername/FeatureGroupOperations.java [207:231]


    public static void deleteExistingFeatureGroups(SageMakerClient sageMakerClient, String[] featureGroupNames) {
        List < FeatureGroupSummary > featureGroups = getAllFeatureGroups(sageMakerClient);

        List < String > deleteFeatureGroupsList = new ArrayList < String > ();

        for (int i = 0; i < featureGroupNames.length; i++) {
            for (int j = 0; j < featureGroups.size(); j++) {
                
                if (featureGroupNames[i].equals(featureGroups.get(j).featureGroupName())) {
                    deleteFeatureGroupsList.add(featureGroupNames[i]);
                    break;
                }
            }
        }

        System.out.println(deleteFeatureGroupsList);
        // If there are duplicate feature groups, delete them
        if (deleteFeatureGroupsList.size() > 0) {
            // Delete FGs
            String[] deleteList = deleteFeatureGroupsList.toArray(new String[0]);
            FeatureGroupOperations.deleteFeatureGroups(sageMakerClient, deleteList);
        } else {
            System.out.println("No feature groups to delete");
        }
    }