![]() ![]() ![]()
Какой рейтинг вас больше интересует?
|
Главная /
Каталог блоговCтраница блогера Yarixxx/Записи в блоге |
![]() |
|
ClassCastException on Queue
2015-06-15 19:29:27 (читать в оригинале)ClassCastException happens when we are trying to add element which cannot be casted to intended type. Here is a simple code which leads to ClassCastException. Queue q = new ArrayBlockingQueue(3); Object s = "a"; System.out.println(q.offer((Integer)s)); it throws exception which starts with the following stacktrace. java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
Java Predicates
2015-06-15 18:48:26 (читать в оригинале)There is a useful class in Java Collections: Predicate. It allows to validate verify elements. The following Predicate checks if String is shorter than 3 letters: Predicate LINES_SHORTER_THAN_3 = new Predicate() { @Override public boolean test(String s) { return s.length() < 3; } }; Another one checks if String starts with H letter. Predicate STARTS_WITH_H […]
NoSuchElementException on Queue
2015-06-15 17:53:02 (читать в оригинале)This exception could happen if queue is empty. System.out.println(q.remove(“4″)); In fact, my experience shows, that: Queue q = new PriorityQueue(2); System.out.println(q.remove()); will fail in the following way: java.util.NoSuchElementException at java.util.AbstractQueue.remove(AbstractQueue.java:117) ...
NullPointerException on Queue
2015-06-15 17:40:51 (читать в оригинале)Another experiment shows that attempt to add null to a queue: Queue q = new PriorityQueue(); System.out.println(q.add(null)); will throw NullPointerException: java.lang.NullPointerException at java.util.PriorityQueue.offer(PriorityQueue.java:335) at java.util.PriorityQueue.add(PriorityQueue.java:321) ...
Тэги: java, nullpointerexception, priorityqueue, queue, uncategorized, записи
Комментарии | Постоянная ссылка
IllegalStateException on Queue
2015-06-15 17:36:30 (читать в оригинале)My experiment shows that the following code: Queue q = new ArrayBlockingQueue(2); System.out.println(q.add(1)); System.out.println(q.add(2)); System.out.println(q.add(3)); will print true twice and then will fall down: java.lang.IllegalStateException: Queue full at java.util.AbstractQueue.add(AbstractQueue.java:98) at java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:312) ...
Тэги: arrayblockingqueue, illegalstateexception, java, queue, uncategorized
Комментарии | Постоянная ссылка
![BlogRider сегодня BlogRider сегодня](/themes/1/i/menu/th/blogrider_today.png)
![Самый-самый блог Самый-самый блог](/themes/1/i/menu/tt/tough.png)
![Изменения рейтинга Изменения рейтинга](/themes/1/i/menu/th/rating_changes.png)
Категория «Поп звезды»
Взлеты Топ 5
![]() | ||
+173 |
226 |
Наша жизнь просто прекрасна |
+168 |
219 |
Little Showroom |
+160 |
212 |
Heilig |
+147 |
233 |
Ulanet.ru - Информационно-развлекательный сайт города Улан-Удэ |
+17 |
29 |
КАТЯ ЧЕХОВА 2008 |
Падения Топ 5
![]() | ||
-1 |
43 |
Диетические рецепты |
-1 |
8 |
Nique |
-1 |
73 |
Список диет |
-2 |
9 |
Vlad_Topalov |
-2 |
10 |
Комедийный сериал |
![Главные темы Главные темы](/themes/1/i/menu/th/main_themes.png)
Популярные за сутки
Загрузка...
![Загрузка... Загрузка...](/themes/1/i/loader/loader.gif)
BlogRider.ru не имеет отношения к публикуемым в записях блогов материалам. Все записи
взяты из открытых общедоступных источников и являются собственностью их авторов.
взяты из открытых общедоступных источников и являются собственностью их авторов.