I think that one specific thematic comparison between Twain and Hemingway would be in how both of them reject institutional constructions of identity in favor of a more individualistic idea of identity. Frederic in A Farewell To Arms is not one to embrace any institutional construction of identity. He lives in a world where institutions have failed. The war has caused a crater of faith in institutions such as organized religion, national identity, and governmental politics. Frederic stands as the witness to what human beings can do to one another, and, as a result, there is nothing but a sense of individual freedom within him. It is a freedom from institutions that sought to externally define the individual. In a similar manner, Huck runs away from "civilization" in his attempt to carve out his own identity. Huck feels that the world around him is "so cramped up and sivilized [sic] as they call it" that he has to reject it. At the same time, Huck's befriending of Jim is a rejection of the social institution of slavery. In Huck's actions, there is a clear rejection of external notions of reality that seek to define the individual. In both works, the theme of individual identity apart from external construction is very important to their overall meaning and relevance. Each seems to be suggesting that individual identity is to be defined apart from society, and that humanity cannot find answers from existing social institutions that emphasize conformity without questioning.
I think that one distinct difference between each work would reside in how the ending of each reflects upon this theme of individualism. Huck Finn seems to affirm that his individualism is essential to his own identity. There is a sense of restoration and redemption in Huck's actions. Regardless of what happens to Huck, Twain seems to be suggesting that there is an intrinsic and inherent unity in Huck's actions because he acts upon his freedom and acts in a way where his conscience has guided him. The unknown that exists is mitigated because of the intrinsic value to Huck's freedom. Hemingway does not offer any such redemptive notion at the end of A Farewell to Arms. Frederic is alone at the end, and is not really able to find much in way of solace. In the final analysis, he is an archetypal figure who is alone and despondent from all else. He acts upon his freedom because there is nothing else for him. Unlike Huck, he is not shown to be able to take solace in the intrinsic freedom he possesses. When he walks back alone in the rain after Catherine has died, it is clear that he enters a world where the is only desolation and isolation in front of him. Huck's acting upon freedom was a positive response to the oppressive forces around him. Frederic's acting upon freedom is more of a necessity, where affirmative definition is not entirely evident.