TheRightGuy

how to turn to stream?

Mar 26th, 2022 (edited)
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.46 KB | None | 0 0
  1. for (int i = 0; i < 10; i++) {
  2.             int randomIndex = (int) (Math.random() * questions.size());
  3.             getQuestion(randomIndex);
  4.             checkInputMatch(randomIndex);
  5.         }
  6. how this
  7. or this
  8. for (int i = 0; i < MAX_LINE; i++) {
  9.             line = bufferedReader.readLine().toLowerCase(Locale.ROOT);
  10.             arrayList.add(line);
  11.         }
  12. or this
  13. private void addAllVideos(BufferedReader bufferedReader) throws IOException {
  14.         String line;
  15.         int MAX_LINE = 22;
  16.         for (int i = 0; i < MAX_LINE; i++) {
  17.             line = bufferedReader.readLine().toLowerCase(Locale.ROOT);
  18.             videos.add(new Video(line, LocalDate.now()));
  19.         }
  20.     }
  21. or this
  22. for (int i = 0; i < sampleMorseCodeInput.length(); i++){
  23.             letterToMorseCode(sampleMorseCodeInput, i);
  24.             audioInitialization.pathForAudio(sampleMorseCodeInput, i);
  25.         }
  26. or this
  27. private boolean isDraw() {
  28.         for (Cell[] players : getGrid()) {
  29.             for (int i = 0; i < getGrid().length; i++) {
  30.                 if (players[i] == null || players[i].getSymbol().equals(" ") || isWinner(Cell.HUMAN)) {
  31.                     return false;
  32.                 }
  33.             }
  34.         }
  35.         return true;
  36.     }
  37. or this
  38. private void runHumansTurn() {
  39.         System.out.println("Pick a number from 1 - 9 ");
  40.         int humanSelectedPosition = input.nextInt();
  41.         while (isCellTaken(getCellPositioning(humanSelectedPosition)) || isRightInput(humanSelectedPosition)) {
  42.             System.out.println("Try again ");
  43.             humanSelectedPosition = input.nextInt();
  44.         }
  45.         getGrid()[(humanSelectedPosition - 1) / 3][(humanSelectedPosition - 1) % 3] = Cell.HUMAN;
  46.     }
  47. or this
  48. private void displayGrid() {
  49.         for (Cell[] players : getGrid()) {
  50.             for (int index = 0; index < getGrid().length; index++) {
  51.                 String symbolText = players[index] == null ? " " : players[index].getSymbol();
  52.  
  53.                 String delimiter = isLastRowIndex(index % getCols()) ? "\n" : "|";
  54.  
  55.                 System.out.print(symbolText + delimiter);
  56.             }
  57.         }
  58.     }
  59. or this
  60. private boolean rightToLeftDiagonalWin(Cell userCharacter) {
  61.         for (int rows = 0; rows < ROWS; rows++) {
  62.             Cell cell = grid[COLS - rows - 1][rows];
  63.             if (cell != userCharacter) {
  64.                 return false;
  65.             }
  66.         }
  67.         return true;
  68.     }
  69. or this
  70. private boolean leftToRightDiagonalWin(Cell userCharacter) {
  71.         for (int i = 0; i < ROWS; i++) {
  72.             Cell cell = grid[i][i];
  73.             if (cell != userCharacter) {
  74.                 return false;
  75.             }
  76.         }
  77.         return true;
  78.     }
  79. or this
  80. private boolean hasWonVertically(Cell userCharacter) {
  81.         for (int col = 0; col < COLS; col++) {
  82.             boolean isColWon = true;
  83.             for (int row = 0; row < ROWS; row++) {
  84.                 Cell cellIndex = grid[row][col];
  85.                 if (cellIndex != userCharacter) {
  86.                     isColWon = false;
  87.                     break;
  88.                 }
  89.             }
  90.  
  91.             if (isColWon) {
  92.                 return true;
  93.             }
  94.         }
  95.         return false;
  96.     }
  97. or this
  98. private int balanceCondition(int balance, int balanceLimit, String message) {
  99.         while (balance > balanceLimit) {
  100.             System.out.println(message);
  101.             balance = input.nextInt();
  102.         }
  103.         return balance;
  104.     }
Add Comment
Please, Sign In to add comment