This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(Iterator<Map.Entry<String, String>> it = map.entrySet().iterator(); it.hasNext(); ) { | |
Map.Entry<String, String> entry = it.next(); | |
if(entry.getKey().equals("remove_entry")) { | |
it.remove(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//метод проверяет, гласная ли буква | |
public static boolean isVowel(char c) | |
{ | |
c = Character.toLowerCase(c); //приводим символ в нижний регистр - от заглавных к строчным буквам | |
for (char d : vowels) //ищем среди массива гласных | |
{ | |
if (c == d) | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Program { | |
public static void main(String[] args) { | |
long start = System.nanoTime(); //померять время выполнения | |
int [] array = new int[150]; | |
Random random = new Random(); | |
int er=0; | |
//заполняем массив случайными числами | |
for (int i=0; i<array.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package TEST; | |
import sun.reflect.generics.tree.Tree; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.*; | |
public class qSort { | |
static Random rand = new Random(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level11.lesson11.bonus03; | |
/* Задача по алгоритмам | |
Написать метод, который возвращает минимальное и максимальное числа в массиве. | |
*/ | |
public class Solution { | |
public static void main(String[] args) throws Exception { | |
int[] data = new int[] {1, 2, 3, 5, -2, -8, 0, 77, 5, 5}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level10.lesson11.home08; | |
import java.util.ArrayList; | |
/* Массив списков строк | |
Создать массив, элементами которого будут списки строк. Заполнить массив любыми данными и вывести их на экран. | |
*/ | |
public class Solution | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level10.lesson11.home05; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
/* Количество букв | |
Ввести с клавиатуры 10 строчек и подсчитать в них количество различных букв (для 33 букв алфавита). Вывести результат на экран. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level09.lesson11.bonus03; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
/* Задача по алгоритмам | |
Задача: Пользователь вводит с клавиатуры список слов (и чисел). Слова вывести в возрастающем порядке, числа - в убывающем. | |
Пример ввода: | |
Вишня |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level09.lesson11.home08; | |
import java.util.ArrayList; | |
import java.util.Random; | |
/* Список из массивов чисел | |
Создать список, элементами которого будут массивы чисел. Добавить в список пять объектов–массивов | |
длиной 5, 2, 4, 7, 0 соответственно. Заполнить массивы любыми данными и вывести их на экран. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level08.lesson11.bonus01; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.*; | |
/* Номер месяца | |
Программа вводит с клавиатуры имя месяца и выводит его номер на экран в виде: «May is 5 month». | |
Используйте коллекции. |
OlderNewer