HashTable Implementation

the resource says the time complexity for the search is O(1) but I’m wondering why that is so, because of the while loop been used in it specifically here
if (head != null) {
while (head != null) {
if (head.key == key) {
return head.value;
head =

shouldn’t it be O(m) where m is the length of the records in a bucket slot,

Also the example been used, inserts strings into the hash table which stores all the records at the position of NaN. is that intentional