"I Wandered Lonely as a Cloud" employs various literary devices to demonstrate that experiences in nature provide deep and meaningful joy which can alleviate feelings of melancholy.
The poem opens with a simile: "I wandered lonely as a cloud." This conveys that the speaker feels separate from his world. He floats aimlessly and without a sense of purpose. This is also an example of anthropomorphism, which is giving a human emotion to a nonhuman object.
There is a regular rhythm to this poem. It is written in iambic tetrameter, which suggests a steady walking pace, reflective of the speaker's trek to this lake. The poem also has a predictable rhyme pattern, which conveys the certain assurance that nature provides in his life.
There are several examples of alliteration. One example is at the end of the second stanza: "Tossing their heads in sprightly dance." The whistling repetition of the s sound is a reminder of the breeze which blows and moves these daffodils.
The poem also employs caesura, demonstrated in this line: "I gazed—and gazed—but little thought." This intentional pause within the line reflects the speaker's efforts to appreciate the beauty before him. This requires his own intentional pause and a commitment to focusing on this scene, much as the reader must slow down and commit to this line for longer than would be necessary without the em dashes.
When the speaker concludes that this thinking back upon this scene of daffodils brings joy to his "heart," he is employing metonymy. Of course, his coronary system is not literally affected by this memory, but his spirit of joy is. We often consider a person's heart to represent his soul or emotional well-being, and that is how the speaker is employing the term heart here.