Вы можете использовать «Command + click» в macOS или «Ctrl + click» в Windows или Linux, когда курсор находится над методом, чтобы увидеть его реализацию.Вы также можете вместо команды нажать «command / ctrl + B», если ваша каретка находится внутри имени метода.Если это неоднозначно, IntelliJ позволит вам выбрать из списка.
Например, чтобы увидеть объявление remove
, вы можете написать этот код:
new ArrayList<String>().remove(1)
И затем команда+ нажмите, чтобы увидеть его объявление:
/**
* Removes the element at the specified position in this list.
* Shifts any subsequent elements to the left (subtracts one from their
* indices).
*
* @param index the index of the element to be removed
* @return the element that was removed from the list
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public E remove(int index) {
rangeCheck(index);
modCount++;
E oldValue = elementData(index);
int numMoved = size - index - 1;
if (numMoved > 0)
System.arraycopy(elementData, index+1, elementData, index,
numMoved);
elementData[--size] = null; // clear to let GC do its work
return oldValue;
}
В качестве альтернативы, вы можете щелкнуть правой кнопкой мыши и выбрать «Перейти к -> Объявление»:
![enter image description here](https://i.stack.imgur.com/IcE54.png)