"And place it in the ears of Joshua" (Exodus 17:14). This teaches that on that very day Joshua was anointed. These are the words of Rabbi Joshua. Rabbi Eleazar of Modi'in says: this is one of four righteous men who were given a hint - two of them were concerned by it and two were not. Moses was given a hint and was not concerned; Jacob was given a hint and was not concerned; David and Mordecai were given a hint and were concerned. How do we know of Moses? "And place it in the ears of Joshua" - He told him that Joshua would give Israel the land as their inheritance, yet in the end Moses stood and pleaded, as it is said (Deuteronomy 3:23), "And I pleaded with the LORD." Jacob was given a hint and was not concerned, as it is said (Genesis 28:15), "And behold, I am with you and will guard you wherever you go," yet in the end he was afraid and trembled, as it is said, "And Jacob was greatly afraid" (Genesis 32:8). A man whom the Holy One, blessed be He, had reassured was trembling? Only that he said: perhaps sin will cause it [to be revoked]. David was given a hint and was concerned, as it is said (1 Samuel 17:36), "Your servant has struck down both the lion and the bear." David said: who am I to count for anything, that I struck down these wild beasts? Rather, he said, perhaps something is destined to befall Israel and they are destined to be saved through me. Mordecai was given a hint and was concerned, as it is said (Esther 2:11), "And every single day Mordecai would walk about." Rather, Mordecai said: is it possible that this devout one [Esther] should be married to this wicked uncircumcised man? Rather, perhaps something is destined to befall Israel and they are destined to be saved through her. "For I will utterly blot out" - "blot out" in this world, "I will blot out" in the world to come. "Remembrance" - this is Haman. "Amalek" - according to its plain meaning.
Four Righteous Men Who Were Given a Hint
Yalkut Shimoni on Torah 266:1
וְשִׂים בְּאָזְנֵי יְהוֹשֻׁעַ, מַגִּיד שֶׁבְּאוֹתוֹ הַיּוֹם נִמְשַׁח יְהוֹשֻׁעַ דִּבְרֵי רַבִּי יְהוֹשֻׁעַ. רַבִּי אֶלְעָזָר הַמּוֹדָעִי אוֹמֵר, זֶה אֶחָד מֵאַרְבַּע צַדִּיקִים שֶׁנִּיתַּן לָהֶם רֶמֶז שְׁנַיִם חָשׁוּ וּשְׁנַיִם לֹא חָשׁוּ. מֹשֶׁה נִיתָּן לוֹ רֶמֶז וְלֹא חָשׁ. יַעֲקֹב נִיתָּן לוֹ רֶמֶז וְלֹא חָשׁ. דָּוִד וּמָרְדְּכַי נִיתָּן לָהֶם רֶמֶז וְחָשׁוּ. מֹשֶׁה מִנַּיִן, וְשִׂים בְּאָזְנֵי יְהוֹשֻׁעַ, אָמַר לוֹ יְהוֹשֻׁעַ מַנְחִיל אֶת יִשְׂרָאֵל הָאָרֶץ, וּבַּסוֹף הָיָה עוֹמֵד וּמִתְחַנֵּן, שֶׁנֶּאֱמַר (דברים ג, כג) "וָאֶתְחַנַּן אֶל ה'". יַעֲקֹב נִיתָּן לוֹ רֶמֶז וְלֹא חָשׁ, שֶׁנֶּאֱמַר (בראשית כח, טו) "וְהִנֵּה אָנֹכִי עִמָּךְ וּשְׁמַרְתִּיךָ בְּכָל אֲשֶׁר תֵּלֵךְ", וּבַּסּוֹף הָיָה יָרֵא וּמִתְפַּחֵד", שֶׁנֶּאֱמַר "וַיִּירָא יַעֲקֹב מְאֹד", אָדָם שֶׁהִבְטִיחוֹ הַמָּקוֹם הָיָה מִתְפַּחֵד, אֶלָּא שֶׁאָמַר שֶׁמָּא יִגְרֹם הַחֵטְא. דָּוִד נִיתָּן לוֹ רֶמֶז וְחָשׁ, שֶׁנֶּאֱמַר (שם יז, לו) "גַּם אֶת הָאֲרִי גַּם הַדּוֹב הִכָּה עַבְדֶךָ", אָמַר דָּוִד וְכִי מָה אֲנִי סָפוּן שֶׁהִכִּיתִי חַיּוֹת רָעוֹת הַלָּלוּ, אֶלָּא אָמַר שֶׁמָּא דָּבָר עָתִיד לְאֵרַע אֶת יִשְׂרָאֵל וְהֵן עֲתִידִין לְהִנָּצֵל עַל יָדַי. מָרְדְּכַי נִיתָּן לוֹ רֶמֶז וְחָשׁ, שֶׁנֶּאֱמַר (אסתר ב, יא) "וּבְכָל יוֹם וָיוֹם מָרְדְּכַי מִתְהַלֵּךְ", אֶלָּא אָמַר מָרְדְּכַי וְכִי אֶפְשָׁר לַחֲסִידָה זוֹ שֶׁתִּנָּשֵׂא לְרָשָׁע עָרֵל הַזֶּה, אֶלָּא שֶׁמָּא עָתִיד לְאֵרַע אֶת יִשְׂרָאֵל דָּבָר וְהֵן עֲתִידִין לְהִנָּצֵל עַל יָדָהּ. כִּי מָחֹה אֶמְחֶה, מָחֹה, בָּעוֹלָם הַזֶּה, אֶמְחֶה, לָעוֹלָם הַבָּא. זֵכֶר, זֶה הָמָן. עֲמָלֵק, כְּמַשְׁמָעוֹ.