Skip to content
Snippets Groups Projects
Select Git revision
  • 2aadc6320ebf33f6aef6ffc92cc7a40ee52186d0
  • master default protected
  • gitkeep
  • dev protected
  • Issue/2218-updateLinksToDocumentationPage
  • Issue/1913-ModificationsResourceMetadata
  • Sprint/2022-01
  • Hotfix/1911-fixFormatting
  • Sprint/2021-2022
  • Issue/912-rearrangeHeader
  • Sprint/2021-22
  • Issue/1743-changedLink
  • Issue/1659-makeViewCardsALink
  • Sprint/2021-15
  • Product/1573-ReadOnlyResources
  • x/linting
  • Topic/1595-IncludeReadonlyValueInResourcesApp
  • Topic/1531-UseMangmntTableView
  • Product/1548-projectInviteMngmnt
  • Sprint/2021-08
  • Hotfix/1475-projectCreateSpinner
  • v1.12.1
  • v1.12.0
  • v1.11.1
  • v1.11.0
  • v1.10.0
  • v1.9.0
  • v1.8.1
  • v1.8.0
  • v1.7.0
  • v1.6.2
  • v1.6.1
  • v1.6.0
  • v1.5.0
  • v1.4.1
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.1.1
  • v1.1.0
  • v1.0.0
41 results

Header.vue

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Main.java 1.25 KiB
    import java.util.*;
    
    public class Main {
        public static void main(String[] args) {
            FunctionalSet<Integer> s = new FunctionalSet<>();
            String line;
            do {
                line = SimpleIO.getString("Enter 'add i', 'remove i', 'min', or 'exit'!");
                String[] words = line.split(" ");
                try {
                    switch (words[0]) {
                    case "exit": break;
                    case "add":
                        s.add(Integer.parseInt(words[1]));
                        System.out.println(s);
                        break;
                    case "remove":
                        s.remove(Integer.parseInt(words[1]));
                        System.out.println(s);
                        break;
                    case "min":
                        System.out.println(s.min(Comparator.<Integer>naturalOrder()));
                        break;
                    default:
                        System.out.println("Unknown command.");
                    }
                } catch (MinimumOfEmptySetException e) {
                    System.out.println("The minimum of the empty set is not defined!");
                } catch (NumberFormatException e) {
                    System.out.println("Failed to parse the number to add/remove.");
                }
            } while (!"exit".equals(line));
        }
    }