When chapter 2 begins, the boys are beginning to come to terms with the fact that they are stranded on a deserted island, and rescue isn't likely to come any time soon.
"Nobody knows where we are. We may be here a long time.”
The boys are shocked into silence at this realization; however, Ralph announces that their time on the island is nothing to worry about. He says that they are on a good island, and they all can enjoy their time on the island waiting for rescue.
“While we’re waiting we can have a good time on this island.”
He gesticulated widely.
“It’s like in a book.”
At once there was a clamor.
“Swallows and Amazons–”
While several books are mentioned, The Coral Island is the allusion that the question is likely referring to. In that particular book, several boys are stranded on an island, and they are forced to fend for themselves. The island is portrayed as near idyllic with abundant food and water available to the boys. Additionally, the boys successfully work together and build shelters and canoes.
The allusion to The Coral Island is deeper than just mentioning the book and having a similar setting. Two of the main characters in The Coral Island are named Jack and Ralph. Those two boys do encounter "primitives" that want to cause them harm, and fire even plays an important role in The Coral Island as well.
Golding was supposedly partially inspired to write Lord of the Flies because of his boyhood experience with The Coral Island. However, Golding fashioned Lord of the Flies as a rebuttal to The Coral Island. In Golding's book, Jack and Ralph definitely do not work together. Most of the boys are incapable of working together for the good of the group. Additionally, Lord of the Flies does have "primitive" characters that want to do harm to other characters. However, those malicious characters are the same characters that initially thought the island would be an idyllic paradise. The boys on the island ultimately become the most dangerous predators on the island. Lastly, fire is important in Golding's book, too; however, it isn't used to rid the island of "false gods" and restore peace. Jack uses the fire as a weapon of destruction in order to hopefully corner and kill Ralph.
At the end of Lord of the Flies, Golding wants to make sure that his readers understand his allusion to The Coral Island is noticed. Ralph is being rescued, and one of the officers mentions that Ralph's experience must have been like the experience of the Ralph in The Coral Island.
“We were together then—”
The officer nodded helpfully.
“I know. Jolly good show. Like the Coral Island.”
As Golding's book comes to its final conclusion, readers are painfully aware that Ralph's island is nothing like the adventure that he and the other boys had initially hoped for.