Why only one element is displayed by count when the list has 5 elements in it?

I made a list of 5 GameObjects and they are being displayed in the hierarchy(inactive though) and the print statement tells that it has 5 elements.
But when I call the GetPlatform method from another class and print the count of the List, it is displaying only 1 element which thereby, is returning null after one iteration.
Why is it happening so?

public class ObjectPooler : MonoBehaviour {

	public GameObject prefab;
	public int size;
	List<GameObject> plat;

	void Start () {
		plat = new List<GameObject> ();
		for (int i = 0; i < size; i++) {
			GameObject o = (GameObject)Instantiate(prefab);
			o.SetActive (false);
			plat.Add (o);
		}
		print (plat.Count);
	}

	public GameObject GetPlatform() {
		print (plat.Count);
		if(plat.Count>0)
		{
			GameObject temp= plat[0];
			plat.RemoveAt(0);
			print ("GetPlatform called");
//			temp.SetActive(true);
			return temp;
		}
		return null;
	}

	public void DestroyPlatform(GameObject obj)
	{
		plat.Add (obj);
		obj.SetActive (false);
	}

}

Its null because you remove the first object from the list and GetPlatform method tries to access first object which is null after first time. Try TrimExcess to get rid of null values: List<T>.TrimExcess Method (System.Collections.Generic) | Microsoft Learn

     public GameObject GetPlatform() {
         print (plat.Count);
         if(plat.Count>0)
         {
             GameObject temp= plat[0];
             plat.RemoveAt(0);
             plat.TrimExcess();
             print ("GetPlatform called");
 //            temp.SetActive(true);
             return temp;
         }
         return null;
     }