Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LazyCollectionNthElement extends AbstractLazyElement {
- @Override
- public String toString() {
- return "parentCollection[" + index + "] = ";
- }
- /*
- не)
- ты не поняла)
- в toString() этого элемента - мы используем toString() родительской коллекции
- и индекс
- т е
- parentCollection.toString() + "[" + index + "]"
- */
- ***********************************
- return Helpers.getTexts(elements).toArray(new String[elements.size()]);
- /*
- да, можно так
- а можно и проще
- http://stackoverflow.com/questions/5374311/convert-arrayliststring-to-string-array
- What is happening is that stock_list.toArray() is creating an Object[] rather than a String[] and hence the typecast is failing.
- The correct code would be:
- String [] stockArr = stockList.toArray(new String[stockList.size()]);
- or even
- String [] stockArr = stockList.toArray(new String[0]);
- For more details, refer to the javadocs for the two overloads of List.toArray.
- (From a technical perspective, the reason for this API behaviour / design is that
- an implementation of the List<T>.toArray() method has no information of what the <T> is at runtime.
- All it knows is that the raw element type is Object.
- By contrast, in the other case, the array parameter gives the base type of the array.
- (If the supplied array is big enough, it is used. Otherwise a new array of the same type and a larger size
- will be allocated and returned as the result.)
- http://javadevnotes.com/java-list-to-array-examples
- */
- ******************************
- public interface DescribesEntity<T> {
- String identity();
- }
- /*
- не надо тут дженериков)
- убирай <T>
- */
- *************************
- public class MyFrameworkTest extends BaseTest {
- /*
- ну, тест-метод в этом классе сложно назать тестом)
- предлагаю просто прибить класс)
- посмотрели как работает - и ок
- */
Advertisement
Add Comment
Please, Sign In to add comment