Какой рейтинг вас больше интересует?
|
Главная /
Каталог блоговCтраница блогера Yarixxx/Записи в блоге |
Java ListIterator
2015-06-17 17:43:24 (читать в оригинале)There is one nice extension for Java Iterator which allows to go back and forward and even obtain current position. Suppose we have a list and obtained ListIterator: List<String> myList = new ArrayList<String>(); myList.add("str1"); myList.add("str2"); myList.add("str3"); ListIterator<String> listIterator = myList.listIterator(); The idea of iterator is staying between elements of list. hasPrevious & hasNext There are […]
Тэги: arrayindexoutofboundsexception, iterator, java, listiterator, uncategorized
Комментарии | Постоянная ссылка
Java Iterator
2015-06-17 16:47:46 (читать в оригинале)There is a nice interface for going over Java Collections, its name Iterator. It allows to remove elements during going over them. The methods are the following: hasNext, next and remove. Suppose we have the following collection: List myList = new ArrayList(); myList.add("str3"); Iterator iterator = myList.iterator(); hasNext This method shows if there are some […]
Тэги: illegalstateexception, iterator, java, nosuchelementexception, uncategorized
Комментарии | Постоянная ссылка
NullPointerException on a List
2015-06-17 14:44:17 (читать в оригинале)As I’ve found there is no standard implementation of List interface which throws NullPointerException on add operation. It is possible to wrap any implementation and throw NullPointerException in such a cases. Here is such example of List which does not allow to store null values. Proudly speaking there are ways to add null values there, […]
UnsupportedOperationException on a List
2015-06-17 13:50:01 (читать в оригинале)There are multiple cases when UnsupportedOperationException can happen. Usually it happens when List implementation haven’t realized this method. For example, if we will try to use the following specialList String[] specialArray = {"str1"}; List specialList = Arrays.asList(specialArray); to add new element: specialList.add("str2"); it will throw exception with the following stacktrace: Exception in thread "main" java.lang.UnsupportedOperationException […]
Тэги: abstractlist, java, list, uncategorized, unsupportedoperationexception
Комментарии | Постоянная ссылка
Deque implementations
2015-06-16 16:52:58 (читать в оригинале)There are several implementations of Deque interface. ArrayDeque It is resizable implementation, this means that after creating it is possible to add as many elements as needed. It is not possible to use null values. It is possible to provided the most probable size at a construction time. Deque d = new ArrayDeque(5); LinkedBlockingDeque It […]
Категория «Журналисты»
Взлеты Топ 5
+406 |
407 |
DDB's LiveJournal |
+350 |
441 |
Жизнь в сети |
+345 |
429 |
Сергей Новиков |
+310 |
443 |
Рояль в кустах |
+54 |
409 |
Сибдепо / Блоги |
Популярные за сутки
Загрузка...
BlogRider.ru не имеет отношения к публикуемым в записях блогов материалам. Все записи
взяты из открытых общедоступных источников и являются собственностью их авторов.
взяты из открытых общедоступных источников и являются собственностью их авторов.