Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
Index your code
hub
/
github.com/wangzheng0822/algo
/ find
Method
find
java/05_array/GenericArray.java:54–61 ·
view source on GitHub ↗
(T e)
Source
from the content-addressed store, hash-verified
52
53
// 获取对应元素的下标, 未找到,返回 -1
54
public
int
find(T e) {
55
for
(
int
i = 0; i < size; i++) {
56
if
(data[i].equals(e)) {
57
return
i;
58
}
59
}
60
return
-1;
61
}
62
63
64
// 在 index 位置,插入元素e, 时间复杂度 O(m+n)
Callers
1
removeElement
Method · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected