chapter_002/src/main/java/ru/job4j/tracker/Tracker.java
/**
     * find item by name in storage
     * @param key - name of item
     * @return item
     */
find item by name in storage
@param key - name of item
@return item
find item by name in storage @param key - name of item @return item
public Item[] findByName(String key) {
        int count = 0;
        Item[] tmp = new Item[position];
        for (int index = 0; index < position; index++) {
            if (items[index] != null && items[index].getName().equals(key)) {
                tmp[count++] = items[index];
            }
        }
        Item[] result = new Item[count];
        System.arraycopy(tmp, 0, result, 0, count);
        return result;
    }
public Item [ ] findByName ( String key ) { int count = 0 ; Item [ ] tmp = new Item [ position ] ; for ( int index = 0 ; index < position ; index ++ ) { if ( items [ index ] != null && items [ index ] . getName ( ) . equals ( key ) ) { tmp [ count ++ ] = items [ index ] ; } } Item [ ] result = new Item [ count ] ; System . arraycopy ( tmp , 0 , result , 0 , count ) ; return result ; }
find item by name in storage
 @param key - name of item
 @return item
find item by name in storage @param key - name of item @return item