This study investigates bipolar and nonpolar resistive-switching of HfO2 with various metal electrodes. Supported by convincing physical and electrical evidence, it is our contention that the composition of conducting filaments in HfO2 strongly depends upon the metal electrodes. Nonpolar resistive-switching with the Ni electrode is attributed to the migration of metal cations and the corresponding electrochemical metallization. Conversely, oxygen-deficient filaments induced by anion migration are responsible for bipolar resistive-switching. It was also found that the characteristic nature of the conducting filaments influences many aspects of switching characteristics, including the switching power, cycling variations, and retention at elevated temperatures.