Q: Get Product id in magento2 Get product_Id using following query,
public function getProductsIdBySku($skus)
    {
        $select = $this->getReadConnection()
            ->select()
            ->from($this->getTable('catalog/product'), array('entity_id'))
            ->where('sku IN (?)', (array) $skus);

        return $this->getReadConnection()->fetchCol($select);
    }

use  \Magento\Catalog\Model\ResourceModel\Product\Collection;
I'm trying to do that in magento2...
$collection = $this->_productCollection->getCollection()->addFieldToSelect('*');

        $collection->getSelect()
                ->reset(\Magento\Framework\DB\Select::COLUMNS)
                ->columns('entity_id');
             ->where('sku = ?', (array) $skus);
                 return $collection;

Its not working for me....If any mistakes in my query ..
Thanks.

A: For magento 2 
  $objectManager = \Magento\Framework\App\ObjectManager::getInstance();

    $skus[]='24-WB01'; 
    $collection = $objectManager->Create('\Magento\Catalog\Model\ResourceModel\Product\Collection')
                  ->addAttributeToFilter('sku', $skus)->getAllIds();              

        //print_r($collection[0]);  
        echo $collection[0];    

get Product id 

A: It's actually a lot easier than that, although I don't know which class $this->_productCollection exactly has:
$collection = $this->_productCollection->getCollection()->addAttributeToFilter('sku', $skus)->getAllIds()
...same as it was in Magento 1.

A: Try this 
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
echo $product->getId();

