The man gave names to all the cattle, and to the birds of the sky, and to every beast of the field, but for Adam there was not found a helper suitable for him. Genesis 2:20 (NASB)
The problem of loneliness plagues us in our culture. While we are surrounded by people all day long, can distract ourselves with television, internet, and talk-radio many people are very, very lonely. Single people are lonely, parents are lonely, elderly are lonely, and married people are lonely. This means that the problem of loneliness is not one of "being alone," it has to be something else.
Adam had none of the things we have today to divert his attention, and there was no one else like him on the entire planet. Yet, I am not sure we could describe Adam as "lonely." It is true that there was no one like him, but Scripture tells us that God was with Adam in the Garden. Adam was used to the fellowship of the Lord as he went about his day in the Garden of Eden. He could not have been lonely in the same way you and I experience it, for he had all he needed in God! Every physical need was met, every emotional need was met and still God said it was not good for Adam to be alone on the earth. In giving him Eve, God gave Adam a companion to share the work of the garden, a partner in his human life and the ability to procreate.
I know people who struggle with loneliness every day of their lives and they are surrounded by family and friends, and I know single folks who live alone, have little companionship but are content and fulfilled and would not describe themselves as being lonely.
Part of it is certainly in the attitude, choosing to embrace the life God has for you and trusting that He has given you His best for this point in your life. God is always intentional and purposeful with what He brings and allows into our lives, and He makes no mistakes. The trouble comes when we decide that what we want (companionship of some sort) is of more importance than what God wants for us. The discontentment that comes from thrashing against God is nearly indescribable and this is where many of my counselees find themselves.
Discontent, pain, and misery are all a result of fighting against what God wants for your life and who He wants in your life. It ceases when you decide to become content with your life as it is right now. Paul said, "I have learned to be content." (Phil 4:12) This means Paul was not always content, but by God's grace and with His divine enablement he learned how to become content despite his sometimes miserable circumstances of life. Remember, when Paul penned those words he was in prison!
You are most likely not in a physical prison awaiting execution. You are most likely not cold, miserable or chained to a wall. However, you may be in a prison of your own making. Discontent is an effective jailer; preventing you from seeing the sunshine because of the internal gloom you carry with you, chaining you to thoughts and desires that breed anger and sorrow, and impeding your progress in life.
I also suggest you don't use the plethora of modern gadgets to dull to distract yourself from the important work that the Lord intends to do in your heart. You must learn to be content with where He has you right now. Acceptance is not easy but it is possible. Surrender to the work the Lord intends to do within you during this time in your life. Immerse yourself in Him and in His Word. Love others and serve the church. This will help ease your loneliness and help you to honor God as He does this important work in your heart.